OLD | NEW |
1 ; RUN: pnacl-llc -mtriple=i386-pc-linux -filetype=asm %s -o - | FileCheck %s | 1 ; RUN: pnacl-llc -mtriple=i386-pc-linux -filetype=asm %s -o - | FileCheck %s |
2 ; RUN: pnacl-llc -mtriple=i386-pc-linux -malign-double -filetype=asm %s -o -| Fi
leCheck %s --check-prefix=MALIGN | 2 ; RUN: pnacl-llc -mtriple=i386-pc-linux -malign-double -filetype=asm %s -o -| Fi
leCheck %s --check-prefix=MALIGN |
3 ; RUN: pnacl-llc -mtriple=i386-unknown-nacl -filetype=asm %s -o -| FileCheck %s
--check-prefix=MALIGN | 3 ; RUN: pnacl-llc -mtriple=i386-unknown-nacl -filetype=asm %s -o -| FileCheck %s
--check-prefix=MALIGN |
4 | 4 |
5 ; Test that the -malign-double flag causes i64 and f64 types to have alignment | 5 ; Test that the -malign-double flag causes i64 and f64 types to have alignment |
6 ; 8 instead of 4. | 6 ; 8 instead of 4. |
7 | 7 |
8 %structi64 = type { i32, i64 } | 8 %structi64 = type { i32, i64 } |
9 | 9 |
10 define i32 @check_i64_size() { | 10 define i32 @check_i64_size() { |
11 ; CHECK-LABEL: check_i64_size: | 11 ; CHECK-LABEL: check_i64_size: |
12 %starti = ptrtoint %structi64* null to i32 | 12 %starti = ptrtoint %structi64* null to i32 |
13 %endp = getelementptr %structi64* null, i32 1 | 13 %endp = getelementptr %structi64, %structi64* null, i32 1 |
14 %endi = ptrtoint %structi64* %endp to i32 | 14 %endi = ptrtoint %structi64* %endp to i32 |
15 %diff = sub i32 %endi, %starti | 15 %diff = sub i32 %endi, %starti |
16 ; CHECK: movl $12, %eax | 16 ; CHECK: movl $12, %eax |
17 ; MALIGN: movl $16, %eax | 17 ; MALIGN: movl $16, %eax |
18 ret i32 %diff | 18 ret i32 %diff |
19 } | 19 } |
20 | 20 |
21 define i32 @check_i64_offset() { | 21 define i32 @check_i64_offset() { |
22 ; CHECK-LABEL: check_i64_offset: | 22 ; CHECK-LABEL: check_i64_offset: |
23 %starti = ptrtoint %structi64* null to i32 | 23 %starti = ptrtoint %structi64* null to i32 |
24 %endp = getelementptr %structi64* null, i32 0, i32 1 | 24 %endp = getelementptr %structi64, %structi64* null, i32 0, i32 1 |
25 %endi = ptrtoint i64* %endp to i32 | 25 %endi = ptrtoint i64* %endp to i32 |
26 %diff = sub i32 %endi, %starti | 26 %diff = sub i32 %endi, %starti |
27 ; CHECK: movl $4, %eax | 27 ; CHECK: movl $4, %eax |
28 ; MALIGN: movl $8, %eax | 28 ; MALIGN: movl $8, %eax |
29 ret i32 %diff | 29 ret i32 %diff |
30 } | 30 } |
31 | 31 |
32 %structf64 = type { i32, double } | 32 %structf64 = type { i32, double } |
33 | 33 |
34 define i32 @check_f64_size() { | 34 define i32 @check_f64_size() { |
35 ; CHECK-LABEL: check_f64_size: | 35 ; CHECK-LABEL: check_f64_size: |
36 %starti = ptrtoint %structf64* null to i32 | 36 %starti = ptrtoint %structf64* null to i32 |
37 %endp = getelementptr %structf64* null, i32 1 | 37 %endp = getelementptr %structf64, %structf64* null, i32 1 |
38 %endi = ptrtoint %structf64* %endp to i32 | 38 %endi = ptrtoint %structf64* %endp to i32 |
39 %diff = sub i32 %endi, %starti | 39 %diff = sub i32 %endi, %starti |
40 ; CHECK: movl $12, %eax | 40 ; CHECK: movl $12, %eax |
41 ; MALIGN: movl $16, %eax | 41 ; MALIGN: movl $16, %eax |
42 ret i32 %diff | 42 ret i32 %diff |
43 } | 43 } |
44 | 44 |
45 define i32 @check_f64_offset() { | 45 define i32 @check_f64_offset() { |
46 ; CHECK-LABEL: check_f64_offset: | 46 ; CHECK-LABEL: check_f64_offset: |
47 %starti = ptrtoint %structf64* null to i32 | 47 %starti = ptrtoint %structf64* null to i32 |
48 %endp = getelementptr %structf64* null, i32 0, i32 1 | 48 %endp = getelementptr %structf64, %structf64* null, i32 0, i32 1 |
49 %endi = ptrtoint double* %endp to i32 | 49 %endi = ptrtoint double* %endp to i32 |
50 %diff = sub i32 %endi, %starti | 50 %diff = sub i32 %endi, %starti |
51 ; CHECK: movl $4, %eax | 51 ; CHECK: movl $4, %eax |
52 ; MALIGN: movl $8, %eax | 52 ; MALIGN: movl $8, %eax |
53 ret i32 %diff | 53 ret i32 %diff |
54 } | 54 } |
OLD | NEW |