[llvm] Allow MIN/MAX signedness flip when operands are known-negative (PR #174469)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 6 02:33:08 PST 2026


================
@@ -0,0 +1,52 @@
+; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+sse2,-sse4.1 < %s | FileCheck %s
+
+declare <16 x i8> @llvm.smax.v16i8(<16 x i8>, <16 x i8>)
+declare <16 x i8> @llvm.smin.v16i8(<16 x i8>, <16 x i8>)
+
+define <16 x i8> @smax_both_negative(<16 x i8> %a, <16 x i8> %b) {
+; CHECK-LABEL: smax_both_negative:
+; CHECK: pmaxub
+  %mask0 = insertelement <16 x i8> poison, i8 -128, i64 0
+  %mask = shufflevector <16 x i8> %mask0, <16 x i8> poison,
+                        <16 x i32> zeroinitializer
----------------
RKSimon wrote:

don't split instructions across multiple lines - ignore col80 
```suggestion
  %mask = shufflevector <16 x i8> %mask0, <16 x i8> poison, <16 x i32> zeroinitializer
```

https://github.com/llvm/llvm-project/pull/174469


More information about the llvm-commits mailing list