OLD | NEW |
1 ; This tests each of the supported NaCl atomic instructions for every | 1 ; This tests each of the supported NaCl atomic instructions for every |
2 ; size allowed. | 2 ; size allowed. |
3 | 3 |
4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
5 ; RUN: | FileCheck %s | 5 ; RUN: | FileCheck %s |
6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
7 ; RUN: | FileCheck --check-prefix=O2 %s | 7 ; RUN: | FileCheck --check-prefix=O2 %s |
8 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ | 8 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
9 ; RUN: | FileCheck %s | 9 ; RUN: | FileCheck %s |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 ;;; Load | 41 ;;; Load |
42 | 42 |
43 ; x86 guarantees load/store to be atomic if naturally aligned. | 43 ; x86 guarantees load/store to be atomic if naturally aligned. |
44 ; The PNaCl IR requires all atomic accesses to be naturally aligned. | 44 ; The PNaCl IR requires all atomic accesses to be naturally aligned. |
45 | 45 |
46 define i32 @test_atomic_load_8(i32 %iptr) { | 46 define i32 @test_atomic_load_8(i32 %iptr) { |
47 entry: | 47 entry: |
48 %ptr = inttoptr i32 %iptr to i8* | 48 %ptr = inttoptr i32 %iptr to i8* |
49 ; parameter value "6" is for the sequential consistency memory order. | 49 ; parameter value "6" is for the sequential consistency memory order. |
50 %i = call i8 @llvm.nacl.atomic.load.i8(i8* %ptr, i32 6) | 50 %i = call i8 @llvm.nacl.atomic.load.i8(i8* %ptr, i32 6) |
51 %r = zext i8 %i to i32 | 51 %i2 = sub i8 %i, 0 |
| 52 %r = zext i8 %i2 to i32 |
52 ret i32 %r | 53 ret i32 %r |
53 } | 54 } |
54 ; CHECK-LABEL: test_atomic_load_8 | 55 ; CHECK-LABEL: test_atomic_load_8 |
55 ; CHECK: mov {{.*}},DWORD | 56 ; CHECK: mov {{.*}},DWORD |
56 ; CHECK: mov {{.*}},BYTE | 57 ; CHECK: mov {{.*}},BYTE |
57 | 58 |
58 define i32 @test_atomic_load_16(i32 %iptr) { | 59 define i32 @test_atomic_load_16(i32 %iptr) { |
59 entry: | 60 entry: |
60 %ptr = inttoptr i32 %iptr to i16* | 61 %ptr = inttoptr i32 %iptr to i16* |
61 %i = call i16 @llvm.nacl.atomic.load.i16(i16* %ptr, i32 6) | 62 %i = call i16 @llvm.nacl.atomic.load.i16(i16* %ptr, i32 6) |
62 %r = zext i16 %i to i32 | 63 %i2 = sub i16 %i, 0 |
| 64 %r = zext i16 %i2 to i32 |
63 ret i32 %r | 65 ret i32 %r |
64 } | 66 } |
65 ; CHECK-LABEL: test_atomic_load_16 | 67 ; CHECK-LABEL: test_atomic_load_16 |
66 ; CHECK: mov {{.*}},DWORD | 68 ; CHECK: mov {{.*}},DWORD |
67 ; CHECK: mov {{.*}},WORD | 69 ; CHECK: mov {{.*}},WORD |
68 | 70 |
69 define i32 @test_atomic_load_32(i32 %iptr) { | 71 define i32 @test_atomic_load_32(i32 %iptr) { |
70 entry: | 72 entry: |
71 %ptr = inttoptr i32 %iptr to i32* | 73 %ptr = inttoptr i32 %iptr to i32* |
72 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) | 74 %r = call i32 @llvm.nacl.atomic.load.i32(i32* %ptr, i32 6) |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 br i1 %cmp, label %done, label %body | 1002 br i1 %cmp, label %done, label %body |
1001 done: | 1003 done: |
1002 ret void | 1004 ret void |
1003 } | 1005 } |
1004 ; O2-LABEL: test_cmpxchg8b_regalloc | 1006 ; O2-LABEL: test_cmpxchg8b_regalloc |
1005 ;;; eax and some other register will be used in the cmpxchg instruction. | 1007 ;;; eax and some other register will be used in the cmpxchg instruction. |
1006 ; O2: lock cmpxchg8b QWORD PTR | 1008 ; O2: lock cmpxchg8b QWORD PTR |
1007 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. | 1009 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. |
1008 ; O2-NOT: {{eax|ecx|edx|ebx}} | 1010 ; O2-NOT: {{eax|ecx|edx|ebx}} |
1009 ; O2: pop ebx | 1011 ; O2: pop ebx |
OLD | NEW |