Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll

Issue 1020853011: Subzero: Fix a lowering bug involving xchg and xadd instructions. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Similar for cmpxchg and cmpxchg8b. Add documentation. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringX8632.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 912
913 not_lock_free: 913 not_lock_free:
914 %z = add i32 %x, %y 914 %z = add i32 %x, %y
915 ret i32 %z 915 ret i32 %z
916 } 916 }
917 ; CHECK-LABEL: test_atomic_is_lock_free_can_dce 917 ; CHECK-LABEL: test_atomic_is_lock_free_can_dce
918 ; CHECK: mov {{.*}},0x1 918 ; CHECK: mov {{.*}},0x1
919 ; CHECK: ret 919 ; CHECK: ret
920 ; CHECK: add 920 ; CHECK: add
921 ; CHECK: ret 921 ; CHECK: ret
922
923 ; Test the liveness / register allocation properties of the xadd instruction.
924 ; Make sure we model that the Src register is modified and therefore it can't
925 ; share a register with an overlapping live range, even if the result of the
926 ; xadd instruction is unused.
927 define void @test_xadd_regalloc() {
928 entry:
929 br label %body
930 body:
931 %i = phi i32 [ 1, %entry ], [ %i_plus_1, %body ]
932 %g = bitcast [4 x i8]* @Global32 to i32*
933 %unused = call i32 @llvm.nacl.atomic.rmw.i32(i32 1, i32* %g, i32 %i, i32 6)
934 %i_plus_1 = add i32 %i, 1
935 %cmp = icmp eq i32 %i_plus_1, 1001
936 br i1 %cmp, label %done, label %body
937 done:
938 ret void
939 }
940 ; O2-LABEL: test_xadd_regalloc
941 ;;; Some register will be used in the xadd instruction.
942 ; O2: lock xadd DWORD PTR {{.*}},[[REG:e..]]
943 ;;; Make sure that register isn't used again, e.g. as the induction variable.
944 ; O2-NOT: [[REG]]
945 ; O2: ret
946
947 ; Do the same test for the xchg instruction instead of xadd.
948 define void @test_xchg_regalloc() {
949 entry:
950 br label %body
951 body:
952 %i = phi i32 [ 1, %entry ], [ %i_plus_1, %body ]
953 %g = bitcast [4 x i8]* @Global32 to i32*
954 %unused = call i32 @llvm.nacl.atomic.rmw.i32(i32 6, i32* %g, i32 %i, i32 6)
955 %i_plus_1 = add i32 %i, 1
956 %cmp = icmp eq i32 %i_plus_1, 1001
957 br i1 %cmp, label %done, label %body
958 done:
959 ret void
960 }
961 ; O2-LABEL: test_xchg_regalloc
962 ;;; Some register will be used in the xchg instruction.
963 ; O2: xchg DWORD PTR {{.*}},[[REG:e..]]
964 ;;; Make sure that register isn't used again, e.g. as the induction variable.
965 ; O2-NOT: [[REG]]
966 ; O2: ret
967
968 ; Same test for cmpxchg.
969 define void @test_cmpxchg_regalloc() {
970 entry:
971 br label %body
972 body:
973 %i = phi i32 [ 1, %entry ], [ %i_plus_1, %body ]
974 %g = bitcast [4 x i8]* @Global32 to i32*
975 %unused = call i32 @llvm.nacl.atomic.cmpxchg.i32(i32* %g, i32 %i, i32 %i, i32 6, i32 6)
976 %i_plus_1 = add i32 %i, 1
977 %cmp = icmp eq i32 %i_plus_1, 1001
978 br i1 %cmp, label %done, label %body
979 done:
980 ret void
981 }
982 ; O2-LABEL: test_cmpxchg_regalloc
983 ;;; eax and some other register will be used in the cmpxchg instruction.
984 ; O2: lock cmpxchg DWORD PTR {{.*}},[[REG:e..]]
985 ;;; Make sure eax isn't used again, e.g. as the induction variable.
986 ; O2-NOT: eax
987 ; O2: ret
988
989 ; Same test for cmpxchg8b.
990 define void @test_cmpxchg8b_regalloc() {
991 entry:
992 br label %body
993 body:
994 %i = phi i32 [ 1, %entry ], [ %i_plus_1, %body ]
995 %g = bitcast [8 x i8]* @Global64 to i64*
996 %i_64 = zext i32 %i to i64
997 %unused = call i64 @llvm.nacl.atomic.cmpxchg.i64(i64* %g, i64 %i_64, i64 %i_64 , i32 6, i32 6)
998 %i_plus_1 = add i32 %i, 1
999 %cmp = icmp eq i32 %i_plus_1, 1001
1000 br i1 %cmp, label %done, label %body
1001 done:
1002 ret void
1003 }
1004 ; O2-LABEL: test_cmpxchg8b_regalloc
1005 ;;; eax and some other register will be used in the cmpxchg instruction.
1006 ; O2: lock cmpxchg8b QWORD PTR
1007 ;;; Make sure eax/ecx/edx/ebx aren't used again, e.g. as the induction variable.
1008 ; O2-NOT: {{eax|ecx|edx|ebx}}
1009 ; O2: pop ebx
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698