[llvm] [AArch64][SVE2] Generate SVE2 BSL instruction in LLVM for bit-twiddling. (PR #83514)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 06:06:20 PST 2024
================
@@ -0,0 +1,21 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64-unknown-linux-gnu -mattr=+sve2 < %s | FileCheck %s --check-prefixes=CHECK
+
+define void @bsl(ptr %ptr1, ptr %ptr2, ptr %ptr3) {
+; CHECK-LABEL: bsl:
+; CHECK: // %bb.0:
+; CHECK-NEXT: ptrue p0.s
+; CHECK-NEXT: mov z0.s, #0x7fffffff
+; CHECK-NEXT: ld1w { z1.s }, p0/z, [x0]
+; CHECK-NEXT: ld1w { z2.s }, p0/z, [x1]
+; CHECK-NEXT: bsl z1.d, z1.d, z2.d, z0.d
+; CHECK-NEXT: st1w { z1.s }, p0, [x2]
+; CHECK-NEXT: ret
+ %1 = load <vscale x 4 x i32>, ptr %ptr1, align 4
+ %2 = load <vscale x 4 x i32>, ptr %ptr2, align 4
+ %3 = and <vscale x 4 x i32> %1, shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 2147483647, i64 0), <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer)
+ %4 = and <vscale x 4 x i32> %2, shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 -2147483648, i64 0), <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer)
+ %5 = or disjoint <vscale x 4 x i32> %3, %4
----------------
sdesmalen-arm wrote:
Why do you think this is set by ScalarEvolution? From what I can see when trying out a simple example that contains no loops (i.e. not requiring scalar evolution), it is added by InstCombine which is always run (https://godbolt.org/z/zY9f7E97j)
https://github.com/llvm/llvm-project/pull/83514
More information about the llvm-commits
mailing list