[llvm] a88be11 - [VectorCombine] Add test coverage for #114901

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 03:49:56 PST 2024


Author: Simon Pilgrim
Date: 2024-11-05T11:42:30Z
New Revision: a88be11eef59b1722030e1219109ea0b76eebbe5

URL: https://github.com/llvm/llvm-project/commit/a88be11eef59b1722030e1219109ea0b76eebbe5
DIFF: https://github.com/llvm/llvm-project/commit/a88be11eef59b1722030e1219109ea0b76eebbe5.diff

LOG: [VectorCombine] Add test coverage for #114901

Added: 
    llvm/test/Transforms/VectorCombine/X86/pr114901.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/VectorCombine/X86/pr114901.ll b/llvm/test/Transforms/VectorCombine/X86/pr114901.ll
new file mode 100644
index 00000000000000..51614ebfc26bd4
--- /dev/null
+++ b/llvm/test/Transforms/VectorCombine/X86/pr114901.ll
@@ -0,0 +1,30 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=sse2 | FileCheck %s --check-prefixes=SSE
+; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=avx2 | FileCheck %s --check-prefixes=AVX
+
+; FIXME: PR114901 - ensure that the ASHR node doesn't commute the operands.
+define i1 @PR114901(<4 x i32> %a) {
+; SSE-LABEL: define i1 @PR114901(
+; SSE-SAME: <4 x i32> [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+; SSE-NEXT:    [[E1:%.*]] = extractelement <4 x i32> [[A]], i32 1
+; SSE-NEXT:    [[E3:%.*]] = extractelement <4 x i32> [[A]], i32 3
+; SSE-NEXT:    [[CMP1:%.*]] = icmp sgt i32 [[E1]], -8
+; SSE-NEXT:    [[CMP3:%.*]] = icmp sgt i32 [[E3]], 42
+; SSE-NEXT:    [[R:%.*]] = ashr i1 [[CMP3]], [[CMP1]]
+; SSE-NEXT:    ret i1 [[R]]
+;
+; AVX-LABEL: define i1 @PR114901(
+; AVX-SAME: <4 x i32> [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+; AVX-NEXT:    [[TMP1:%.*]] = icmp sgt <4 x i32> [[A]], <i32 poison, i32 -8, i32 poison, i32 42>
+; AVX-NEXT:    [[SHIFT:%.*]] = shufflevector <4 x i1> [[TMP1]], <4 x i1> poison, <4 x i32> <i32 poison, i32 3, i32 poison, i32 poison>
+; AVX-NEXT:    [[TMP2:%.*]] = ashr <4 x i1> [[TMP1]], [[SHIFT]]
+; AVX-NEXT:    [[R:%.*]] = extractelement <4 x i1> [[TMP2]], i64 1
+; AVX-NEXT:    ret i1 [[R]]
+;
+  %e1 = extractelement <4 x i32> %a, i32 1
+  %e3 = extractelement <4 x i32> %a, i32 3
+  %cmp1 = icmp sgt i32 %e1, 4294967288
+  %cmp3 = icmp sgt i32 %e3, 42
+  %r = ashr i1 %cmp3, %cmp1
+  ret i1 %r
+}


        


More information about the llvm-commits mailing list