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

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

Issue 607353002: Subzero: Fix emission of 16-bit immediates. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add tests 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
« no previous file with comments | « src/assembler_ia32.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2a9fcb47329c55a71ac80b672c31043df79541d9..a80fe5b0597ca1ac4a7f3958a906042721fdb977 100644
--- a/tests_lit/assembler/x86/immediate_encodings.ll
+++ b/tests_lit/assembler/x86/immediate_encodings.ll
@@ -44,6 +44,67 @@ entry:
; CHECK-LABEL: testXor8Imm8NotEAX
; CHECK: 80 f{{[1-3]}} 7f xor {{[^a]}}l, 127
+define internal i32 @testXor16Imm8(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %result_i16 = xor i16 %arg_i16, 127
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testXor16Imm8
+; CHECK: 66 83 f0 7f xor ax, 127
+
+define internal i32 @testXor16Imm8Neg(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %result_i16 = xor i16 %arg_i16, -128
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testXor16Imm8Neg
+; CHECK: 66 83 f0 80 xor ax, 128
+
+define internal i32 @testXor16Imm16Eax(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %tmp = xor i16 %arg_i16, 1024
+ %result_i16 = add i16 %tmp, 1
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testXor16Imm16Eax
+; CHECK: 66 35 00 04 xor ax, 1024
+; CHECK-NEXT: add ax, 1
+
+define internal i32 @testXor16Imm16NegEax(i32 %arg) {
+entry:
+ %arg_i16 = trunc i32 %arg to i16
+ %tmp = xor i16 %arg_i16, -256
+ %result_i16 = add i16 %tmp, 1
+ %result = zext i16 %result_i16 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testXor16Imm16NegEax
+; CHECK: 66 35 00 ff xor ax, 65280
Jim Stichnoth 2014/09/28 18:14:28 Oddly, this part works correctly in master.
jvoung (off chromium) 2014/09/29 01:16:56 I think that llvm-objdump semi-silently ignored th
+; CHECK-NEXT: add ax, 1
+
+define internal i32 @testXor16Imm16NotEAX(i32 %arg_i32, i32 %arg2_i32, i32 %arg3_i32) {
+entry:
+ %arg = trunc i32 %arg_i32 to i16
+ %arg2 = trunc i32 %arg2_i32 to i16
+ %arg3 = trunc i32 %arg3_i32 to i16
+ %x = xor i16 %arg, 32767
+ %x2 = xor i16 %arg2, 32767
+ %x3 = xor i16 %arg3, 32767
+ %add1 = add i16 %x, %x2
+ %add2 = add i16 %add1, %x3
+ %result = zext i16 %add2 to i32
+ ret i32 %result
+}
+; CHECK-LABEL: testXor16Imm16NotEAX
+; CHECK: 66 81 f{{[1-3]}} ff 7f xor {{[^a]}}x, 32767
+; CHECK-NEXT: 66 81 f{{[1-3]}} ff 7f xor {{[^a]}}x, 32767
+
define internal i32 @testXor32Imm8(i32 %arg) {
entry:
%result = xor i32 %arg, 127
« no previous file with comments | « src/assembler_ia32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698