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: -allow-externally-defined-symbols | FileCheck %s | 5 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
7 ; RUN: -allow-externally-defined-symbols | FileCheck --check-prefix=O2 %s | 7 ; RUN: -allow-externally-defined-symbols | 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: -allow-externally-defined-symbols | FileCheck %s | 9 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
10 | 10 |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 ; CHECK-LABEL: test_atomic_cmpxchg_8 | 1061 ; CHECK-LABEL: test_atomic_cmpxchg_8 |
1062 ; CHECK: mov eax,{{.*}} | 1062 ; CHECK: mov eax,{{.*}} |
1063 ; Need to check that eax isn't used as the address register or the desired. | 1063 ; Need to check that eax isn't used as the address register or the desired. |
1064 ; since it is already used as the *expected* register. | 1064 ; since it is already used as the *expected* register. |
1065 ; CHECK: lock cmpxchg BYTE PTR [e{{[^a].}}],{{[^a]}}l | 1065 ; CHECK: lock cmpxchg BYTE PTR [e{{[^a].}}],{{[^a]}}l |
1066 ; ARM32-LABEL: test_atomic_cmpxchg_8 | 1066 ; ARM32-LABEL: test_atomic_cmpxchg_8 |
1067 ; ARM32: dmb | 1067 ; ARM32: dmb |
1068 ; ARM32: ldrexb | 1068 ; ARM32: ldrexb |
1069 ; ARM32: cmp | 1069 ; ARM32: cmp |
1070 ; ARM32: strexbeq | 1070 ; ARM32: strexbeq |
1071 ; ARM32: {{str|mov}}ne | 1071 ; ARM32: {{strb|mov}}ne |
1072 ; ARM32: cmpeq | 1072 ; ARM32: cmpeq |
1073 ; ARM32: bne | 1073 ; ARM32: bne |
1074 ; ARM32: dmb | 1074 ; ARM32: dmb |
1075 | 1075 |
1076 define internal i32 @test_atomic_cmpxchg_16(i32 %iptr, i32 %expected, | 1076 define internal i32 @test_atomic_cmpxchg_16(i32 %iptr, i32 %expected, |
1077 i32 %desired) { | 1077 i32 %desired) { |
1078 entry: | 1078 entry: |
1079 %trunc_exp = trunc i32 %expected to i16 | 1079 %trunc_exp = trunc i32 %expected to i16 |
1080 %trunc_des = trunc i32 %desired to i16 | 1080 %trunc_des = trunc i32 %desired to i16 |
1081 %ptr = inttoptr i32 %iptr to i16* | 1081 %ptr = inttoptr i32 %iptr to i16* |
1082 %old = call i16 @llvm.nacl.atomic.cmpxchg.i16(i16* %ptr, i16 %trunc_exp, | 1082 %old = call i16 @llvm.nacl.atomic.cmpxchg.i16(i16* %ptr, i16 %trunc_exp, |
1083 i16 %trunc_des, i32 6, i32 6) | 1083 i16 %trunc_des, i32 6, i32 6) |
1084 %old_ext = zext i16 %old to i32 | 1084 %old_ext = zext i16 %old to i32 |
1085 ret i32 %old_ext | 1085 ret i32 %old_ext |
1086 } | 1086 } |
1087 ; CHECK-LABEL: test_atomic_cmpxchg_16 | 1087 ; CHECK-LABEL: test_atomic_cmpxchg_16 |
1088 ; CHECK: mov eax,{{.*}} | 1088 ; CHECK: mov eax,{{.*}} |
1089 ; CHECK: lock cmpxchg WORD PTR [e{{[^a].}}],{{[^a]}}x | 1089 ; CHECK: lock cmpxchg WORD PTR [e{{[^a].}}],{{[^a]}}x |
1090 ; ARM32-LABEL: test_atomic_cmpxchg_16 | 1090 ; ARM32-LABEL: test_atomic_cmpxchg_16 |
1091 ; ARM32: dmb | 1091 ; ARM32: dmb |
1092 ; ARM32: ldrexh | 1092 ; ARM32: ldrexh |
1093 ; ARM32: cmp | 1093 ; ARM32: cmp |
1094 ; ARM32: strexheq | 1094 ; ARM32: strexheq |
1095 ; ARM32: {{str|mov}}ne | 1095 ; ARM32: {{strh|mov}}ne |
1096 ; ARM32: cmpeq | 1096 ; ARM32: cmpeq |
1097 ; ARM32: bne | 1097 ; ARM32: bne |
1098 ; ARM32: dmb | 1098 ; ARM32: dmb |
1099 | 1099 |
1100 define internal i32 @test_atomic_cmpxchg_32(i32 %iptr, i32 %expected, | 1100 define internal i32 @test_atomic_cmpxchg_32(i32 %iptr, i32 %expected, |
1101 i32 %desired) { | 1101 i32 %desired) { |
1102 entry: | 1102 entry: |
1103 %ptr = inttoptr i32 %iptr to i32* | 1103 %ptr = inttoptr i32 %iptr to i32* |
1104 %old = call i32 @llvm.nacl.atomic.cmpxchg.i32(i32* %ptr, i32 %expected, | 1104 %old = call i32 @llvm.nacl.atomic.cmpxchg.i32(i32* %ptr, i32 %expected, |
1105 i32 %desired, i32 6, i32 6) | 1105 i32 %desired, i32 6, i32 6) |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 br i1 %cmp, label %done, label %body | 1464 br i1 %cmp, label %done, label %body |
1465 done: | 1465 done: |
1466 ret void | 1466 ret void |
1467 } | 1467 } |
1468 ; O2-LABEL: test_cmpxchg8b_regalloc | 1468 ; O2-LABEL: test_cmpxchg8b_regalloc |
1469 ;;; eax and some other register will be used in the cmpxchg instruction. | 1469 ;;; eax and some other register will be used in the cmpxchg instruction. |
1470 ; O2: lock cmpxchg8b QWORD PTR | 1470 ; O2: lock cmpxchg8b QWORD PTR |
1471 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. | 1471 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable. |
1472 ; O2-NOT: {{eax|ecx|edx|ebx}} | 1472 ; O2-NOT: {{eax|ecx|edx|ebx}} |
1473 ; O2: pop ebx | 1473 ; O2: pop ebx |
OLD | NEW |