[llvm] [AArch64][SVE] Combine UXT[BHW] intrinsics to AND. (PR #137956)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu May 1 05:32:27 PDT 2025
================
@@ -0,0 +1,342 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
+target triple = "aarch64-unknown-linux-gnu"
+
+define <vscale x 2 x i64> @uxtb_z_64(<vscale x 2 x i64> %0) #0 {
+; CHECK-LABEL: define <vscale x 2 x i64> @uxtb_z_64(
+; CHECK-SAME: <vscale x 2 x i64> [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[TMP2:%.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.and.u.nxv2i64(<vscale x 2 x i1> splat (i1 true), <vscale x 2 x i64> [[TMP0]], <vscale x 2 x i64> splat (i64 255))
+; CHECK-NEXT: ret <vscale x 2 x i64> [[TMP2]]
+;
+ %2 = tail call <vscale x 2 x i64> @llvm.aarch64.sve.uxtb.nxv2i64(<vscale x 2 x i64> zeroinitializer, <vscale x 2 x i1> splat (i1 true), <vscale x 2 x i64> %0)
+ ret <vscale x 2 x i64> %2
+}
----------------
paulwalker-arm wrote:
Do any of the `_z_` tests add value? The new combine doesn't care about the passthrough value, only whether it is `undef` or not.
The `_z_` tests aside, it's up to you but I feel many of the other tests can also be removed. I think you only need to test a single element type for the core functionality (i.e. positive and negative tests relating to whether the combine is applied) and then a single test per element type to show the correct `and_u` equivalent is created.
https://github.com/llvm/llvm-project/pull/137956
More information about the llvm-commits
mailing list