OLD | NEW |
(Empty) | |
| 1 ; RUN: pnacl-llc -mtriple=i386-unknown-nacl -filetype=asm %s -o - \ |
| 2 ; RUN: | FileCheck -check-prefix=X32 %s |
| 3 |
| 4 ; RUN: pnacl-llc -mtriple=i386-unknown-nacl -filetype=asm -mtls-use-call %s -o -
\ |
| 5 ; RUN: | FileCheck -check-prefix=USE_CALL %s |
| 6 |
| 7 ; RUN: pnacl-llc -mtriple=x86_64-unknown-nacl -filetype=asm %s -o - \ |
| 8 ; RUN: | FileCheck -check-prefix=USE_CALL %s |
| 9 |
| 10 ; "-mtls-use-call" should not make any difference on x86-64. |
| 11 ; RUN: pnacl-llc -mtriple=x86_64-unknown-nacl -filetype=asm -mtls-use-call %s -o
- \ |
| 12 ; RUN: | FileCheck -check-prefix=USE_CALL %s |
| 13 |
| 14 |
| 15 declare i8* @llvm.nacl.read.tp() |
| 16 |
| 17 define i8* @get_thread_pointer() { |
| 18 %tp = call i8* @llvm.nacl.read.tp() |
| 19 ret i8* %tp |
| 20 } |
| 21 |
| 22 ; X32: get_thread_pointer: |
| 23 ; X32: movl %gs:0, %eax |
| 24 |
| 25 ; USE_CALL: get_thread_pointer: |
| 26 ; USE_CALL: call{{[lq]?}} __nacl_read_tp |
| 27 |
| 28 |
| 29 ; Make sure that we do not generate: |
| 30 ; movl $1000, %eax |
| 31 ; addl %gs:0, %eax |
| 32 ; The x86-32 NaCl validator only accepts %gs with "mov", not with |
| 33 ; "add". Note that we had to use a large immediate to trigger the bug |
| 34 ; and generate the code above. |
| 35 define i8* @get_thread_pointer_add() { |
| 36 %tp = call i8* @llvm.nacl.read.tp() |
| 37 %result = getelementptr i8* %tp, i32 1000 |
| 38 ret i8* %result |
| 39 } |
| 40 |
| 41 ; X32: get_thread_pointer_add: |
| 42 ; X32: movl %gs:0, %eax |
| 43 ; X32: addl $1000, %eax |
OLD | NEW |