[PATCH] D158479: [clang] Support elementwise builtin for sizeless vector type

Paul Walker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 02:51:55 PDT 2023


paulwalker-arm added inline comments.


================
Comment at: clang/test/CodeGen/aarch64-sve-vector-elementwise-ops.c:128-131
+// CHECK-NEXT:    [[ELT_MIN:%.*]] = call <vscale x 16 x i8> @llvm.umin.nxv16i8(<vscale x 16 x i8> [[VI8:%.*]], <vscale x 16 x i8> [[VI8]])
+// CHECK-NEXT:    [[ELT_MIN1:%.*]] = call <vscale x 8 x i16> @llvm.umin.nxv8i16(<vscale x 8 x i16> [[VI16:%.*]], <vscale x 8 x i16> [[VI16]])
+// CHECK-NEXT:    [[ELT_MIN2:%.*]] = call <vscale x 4 x i32> @llvm.umin.nxv4i32(<vscale x 4 x i32> [[VI32:%.*]], <vscale x 4 x i32> [[VI32]])
+// CHECK-NEXT:    [[ELT_MIN3:%.*]] = call <vscale x 2 x i64> @llvm.umin.nxv2i64(<vscale x 2 x i64> [[VI64:%.*]], <vscale x 2 x i64> [[VI64]])
----------------
These should be `smin` rather than `umin`?


================
Comment at: clang/test/CodeGen/aarch64-sve-vector-elementwise-ops.c:208-210
+// CHECK-NEXT:    [[ELT_COS:%.*]] = call <vscale x 8 x half> @llvm.cos.nxv8f16(<vscale x 8 x half> [[VF16:%.*]])
+// CHECK-NEXT:    [[ELT_COS1:%.*]] = call <vscale x 4 x float> @llvm.cos.nxv4f32(<vscale x 4 x float> [[VF32:%.*]])
+// CHECK-NEXT:    [[ELT_COS2:%.*]] = call <vscale x 2 x double> @llvm.cos.nxv2f64(<vscale x 2 x double> [[VF64:%.*]])
----------------
This highlights a potential sticking point because can we code generate such intrinsics for scalable vectors?  LoopVectorize will emit calls to a vector math library rather than call this intrinsic directly.  There's also the replace-with-veclib pass that will convert such intrinsics, again only if there's a suitable math library available.

Is it a good idea to allow builtins that we know will cause a code generation failure? Or might result in a scalarised implementation?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158479/new/

https://reviews.llvm.org/D158479



More information about the cfe-commits mailing list