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

Unified Diff: tests_lit/llvm2ice_tests/multidef_kill.ll

Issue 1678523002: Subzero: Fix a mul lowering error. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/multidef_kill.ll
diff --git a/tests_lit/llvm2ice_tests/multidef_kill.ll b/tests_lit/llvm2ice_tests/multidef_kill.ll
new file mode 100644
index 0000000000000000000000000000000000000000..51ad3977fa63c1291f1006890bea43c2cf29e425
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/multidef_kill.ll
@@ -0,0 +1,41 @@
+; This tests against a lowering error in a multiply instruction that produces
+; results in a low and high register. This is usually lowered as a mul
+; instruction whose dest contains the low portion, and a FakeDef of the high
+; portion. The problem is that if the high portion is unused (e.g. the multiply
+; is followed by a truncation), the FakeDef may be eliminated, and the register
+; allocator may assign the high register to a variable that is live across the
+; mul instruction. This is incorrect because the mul instruction smashes the
+; register.
+
+; REQUIRES: allow_dump
+
+; RUN: %p2i --target x8632 -i %s --filetype=asm --args -O2 -asm-verbose \
+; RUN: --reg-use=eax,edx -reg-reserve | FileCheck --check-prefix=X8632 %s
+; RUN: %p2i --target arm32 -i %s --filetype=asm --args -O2 -asm-verbose \
+; RUN: | FileCheck --check-prefix=ARM32 %s
+
+define internal i32 @mul(i64 %a, i64 %b, i32 %c) {
+ ; Force an early use of %c.
+ store i32 %c, i32* undef, align 1
+ %m = mul i64 %a, %b
+ %t = trunc i64 %m to i32
+ ; Make many uses of %c to give it high weight.
+ %t1 = add i32 %t, %c
+ %t2 = add i32 %t1, %c
+ %t3 = add i32 %t2, %c
+ ret i32 %t3
+}
+
+; For x8632, we want asm-verbose to print the stack offset assignment for lv$c
+; ("local variable 'c'") in the prolog, and then have at least one use of lv$c
+; in the body, i.e. don't register-allocate edx to %c.
+
+; X8632-LABEL: mul
+; X8632: lv$c =
+; X8632: lv$c
+
+; For arm32, the failure would manifest as a translation error - no register
+; being allocated to the high operand, so we just check for successful
+; translation.
+
+; ARM32-LABEL: mul
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698