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

Unified Diff: tests_lit/assembler/x86/immediate_encodings.ll

Issue 617593002: Handle imul, pcmpeq, pcmpgt. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: go ahead and optimize i8 Created 6 years, 3 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
Index: tests_lit/assembler/x86/immediate_encodings.ll
diff --git a/tests_lit/assembler/x86/immediate_encodings.ll b/tests_lit/assembler/x86/immediate_encodings.ll
index a80fe5b0597ca1ac4a7f3958a906042721fdb977..ff23e55d5d3d3c2b2aac3cedf1d5a990d97e43df 100644
--- a/tests_lit/assembler/x86/immediate_encodings.ll
+++ b/tests_lit/assembler/x86/immediate_encodings.ll
@@ -171,5 +171,88 @@ entry:
; CHECK-LABEL: testSub8Imm8
; CHECK: 2c 7d sub al, 125
+; imul has some shorter 8-bit immediate encodings.
+; It also has a shorter encoding for eax, but we don't do that yet.
+
+define internal i32 @testMul16Imm8(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %tmp = mul i16 %arg_i16, 99
+ %result_i16 = add i16 %tmp, 1
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testMul16Imm8
+; CHECK: 66 6b c0 63 imul ax, ax, 99
+; CHECK-NEXT: add ax, 1
+
+define internal i32 @testMul16Imm8Neg(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %tmp = mul i16 %arg_i16, -111
+ %result_i16 = add i16 %tmp, 1
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testMul16Imm8Neg
+; CHECK: 66 6b c0 91 imul ax, ax, 145
+; CHECK-NEXT: add ax, 1
+
+define internal i32 @testMul16Imm16(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %tmp = mul i16 %arg_i16, 1024
+ %result_i16 = add i16 %tmp, 1
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testMul16Imm16
+; CHECK: 66 69 c0 00 04 imul ax, ax, 1024
+; CHECK-NEXT: add ax, 1
+
+define internal i32 @testMul16Imm16Neg(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %tmp = mul i16 %arg_i16, -256
+ %result_i16 = add i16 %tmp, 1
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testMul16Imm16Neg
+; CHECK: 66 69 c0 00 ff imul ax, ax, 65280
+; CHECK-NEXT: add ax, 1
+
+define internal i32 @testMul32Imm8(i32 %arg) {
+entry:
+ %result = mul i32 %arg, 99
+ ret i32 %result
+}
+; CHECK-LABEL: testMul32Imm8
+; CHECK: 6b c0 63 imul eax, eax, 99
+
+define internal i32 @testMul32Imm8Neg(i32 %arg) {
+entry:
+ %result = mul i32 %arg, -111
+ ret i32 %result
+}
+; CHECK-LABEL: testMul32Imm8Neg
+; CHECK: 6b c0 91 imul eax, eax, -111
+
+define internal i32 @testMul32Imm16(i32 %arg) {
+entry:
+ %result = mul i32 %arg, 1024
+ ret i32 %result
+}
+; CHECK-LABEL: testMul32Imm16
+; CHECK: 69 c0 00 04 00 00 imul eax, eax, 1024
+
+define internal i32 @testMul32Imm16Neg(i32 %arg) {
+entry:
+ %result = mul i32 %arg, -256
+ ret i32 %result
+}
+; CHECK-LABEL: testMul32Imm16Neg
+; CHECK: 69 c0 00 ff ff ff imul eax, eax, 4294967040
+
; ERRORS-NOT: ICE translation error
; DUMP-NOT: SZ

Powered by Google App Engine
This is Rietveld 408576698