[llvm] [DAG] optimize llvm.ucmp for 1-bit inputs to return subtraction of operands (PR #150058)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 03:47:53 PDT 2025


================
@@ -0,0 +1,13 @@
+; RUN: llc -o - %s | FileCheck %s
+define i8 @test_ucmp_i8_i1(i1 zeroext %a, i1 zeroext %b) {
+  %cmp = call i8 @llvm.ucmp.i8.i1(i1 %a, i1 %b)
+  ret i8 %cmp
+}
+
+define i16 @test_ucmp_i16_i1(i1 zeroext %a, i1 zeroext %b) {
+  %cmp = call i16 @llvm.ucmp.i16.i1(i1 %a, i1 %b)
+  ret i16 %cmp
+}
----------------
RKSimon wrote:

Don't use generic - use a real target (any of x86/aarch64/riscv would be a good choice) and ensure the results are checked - preferably with the update_llc_test_checks.py script

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


More information about the llvm-commits mailing list