[llvm] a698790 - [X86] Add additional tests to no-shift.ll
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 22:44:52 PST 2023
Author: Noah Goldstein
Date: 2023-01-06T14:44:45+08:00
New Revision: a698790c51ec2804c3a7ba4c59438e7816690ea2
URL: https://github.com/llvm/llvm-project/commit/a698790c51ec2804c3a7ba4c59438e7816690ea2
DIFF: https://github.com/llvm/llvm-project/commit/a698790c51ec2804c3a7ba4c59438e7816690ea2.diff
LOG: [X86] Add additional tests to no-shift.ll
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D141076
Added:
Modified:
llvm/test/CodeGen/X86/not-shift.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/not-shift.ll b/llvm/test/CodeGen/X86/not-shift.ll
index b0c93a73d15b2..67de3f240ed58 100644
--- a/llvm/test/CodeGen/X86/not-shift.ll
+++ b/llvm/test/CodeGen/X86/not-shift.ll
@@ -641,3 +641,72 @@ define i32 @xor1s_shiftr32(i32 %val, i32 %cnt) nounwind {
%result = lshr i32 %val, %adjcnt
ret i32 %result
}
+define i32 @invalid_sub31(i32 %val, i32 %cnt) nounwind {
+; X86-NOBMI2-LABEL: invalid_sub31:
+; X86-NOBMI2: # %bb.0:
+; X86-NOBMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NOBMI2-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NOBMI2-NEXT: addb $-31, %cl
+; X86-NOBMI2-NEXT: shll %cl, %eax
+; X86-NOBMI2-NEXT: retl
+;
+; X86-BMI2-LABEL: invalid_sub31:
+; X86-BMI2: # %bb.0:
+; X86-BMI2-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; X86-BMI2-NEXT: addb $-31, %al
+; X86-BMI2-NEXT: shlxl %eax, {{[0-9]+}}(%esp), %eax
+; X86-BMI2-NEXT: retl
+;
+; X64-NOBMI2-LABEL: invalid_sub31:
+; X64-NOBMI2: # %bb.0:
+; X64-NOBMI2-NEXT: # kill: def $esi killed $esi def $rsi
+; X64-NOBMI2-NEXT: movl %edi, %eax
+; X64-NOBMI2-NEXT: leal -31(%rsi), %ecx
+; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
+; X64-NOBMI2-NEXT: shll %cl, %eax
+; X64-NOBMI2-NEXT: retq
+;
+; X64-BMI2-LABEL: invalid_sub31:
+; X64-BMI2: # %bb.0:
+; X64-BMI2-NEXT: addb $-31, %sil
+; X64-BMI2-NEXT: shlxl %esi, %edi, %eax
+; X64-BMI2-NEXT: retq
+ %adjcnt = sub i32 %cnt, 31
+ %result = shl i32 %val, %adjcnt
+ ret i32 %result
+}
+
+define i32 @invalid_add31(i32 %val, i32 %cnt) nounwind {
+; X86-NOBMI2-LABEL: invalid_add31:
+; X86-NOBMI2: # %bb.0:
+; X86-NOBMI2-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NOBMI2-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
+; X86-NOBMI2-NEXT: addb $31, %cl
+; X86-NOBMI2-NEXT: shll %cl, %eax
+; X86-NOBMI2-NEXT: retl
+;
+; X86-BMI2-LABEL: invalid_add31:
+; X86-BMI2: # %bb.0:
+; X86-BMI2-NEXT: movzbl {{[0-9]+}}(%esp), %eax
+; X86-BMI2-NEXT: addb $31, %al
+; X86-BMI2-NEXT: shlxl %eax, {{[0-9]+}}(%esp), %eax
+; X86-BMI2-NEXT: retl
+;
+; X64-NOBMI2-LABEL: invalid_add31:
+; X64-NOBMI2: # %bb.0:
+; X64-NOBMI2-NEXT: # kill: def $esi killed $esi def $rsi
+; X64-NOBMI2-NEXT: movl %edi, %eax
+; X64-NOBMI2-NEXT: leal 31(%rsi), %ecx
+; X64-NOBMI2-NEXT: # kill: def $cl killed $cl killed $ecx
+; X64-NOBMI2-NEXT: shll %cl, %eax
+; X64-NOBMI2-NEXT: retq
+;
+; X64-BMI2-LABEL: invalid_add31:
+; X64-BMI2: # %bb.0:
+; X64-BMI2-NEXT: addb $31, %sil
+; X64-BMI2-NEXT: shlxl %esi, %edi, %eax
+; X64-BMI2-NEXT: retq
+ %adjcnt = add i32 %cnt, 31
+ %result = shl i32 %val, %adjcnt
+ ret i32 %result
+}
More information about the llvm-commits
mailing list