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