[llvm] llvm.lround: Update verifier to validate support of vector types. (PR #98950)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 10:09:23 PDT 2024


================
@@ -0,0 +1,30 @@
+; Validate that vector types are accepted for llvm.lround/llvm.llround intrinsic
+; RUN: llvm-as < %s | llvm-dis |  FileCheck %s
+
+define <2 x i32> @intrinsic_lround_v2i32_v2f32(<2 x float> %arg) {
+entry:
+  ;CHECK: %res = tail call <2 x i32> @llvm.lround.v2i32.v2f32(<2 x float> %arg)
+  %res = tail call <2 x i32> @llvm.lround.v2i32.v2f32(<2 x float> %arg)
+  ret <2 x i32> %res
+}
+
+define <2 x i32> @intrinsic_llround_v2i32_v2f32(<2 x float> %arg) {
+entry:
+  ;CHECK: %res = tail call <2 x i32> @llvm.llround.v2i32.v2f32(<2 x float> %arg)
+  %res = tail call <2 x i32> @llvm.llround.v2i32.v2f32(<2 x float> %arg)
+  ret <2 x i32> %res
+}
+
+define <2 x i64> @intrinsic_lround_v2i64_v2f32(<2 x float> %arg) {
+entry:
+  ;CHECK: %res = tail call <2 x i64> @llvm.lround.v2i64.v2f32(<2 x float> %arg)
+  %res = tail call <2 x i64> @llvm.lround.v2i64.v2f32(<2 x float> %arg)
+  ret <2 x i64> %res
+}
+
+define <2 x i64> @intrinsic_llround_v2i64_v2f32(<2 x float> %arg) {
+entry:
+  ;CHECK: %res = tail call <2 x i64> @llvm.llround.v2i64.v2f32(<2 x float> %arg)
+  %res = tail call <2 x i64> @llvm.llround.v2i64.v2f32(<2 x float> %arg)
+  ret <2 x i64> %res
----------------
arsenm wrote:

```suggestion
define <2 x i32> @intrinsic_lround_v2i32_v2f32(<2 x float> %arg) {
  ;CHECK: %res = tail call <2 x i32> @llvm.lround.v2i32.v2f32(<2 x float> %arg)
  %res = tail call <2 x i32> @llvm.lround.v2i32.v2f32(<2 x float> %arg)
  ret <2 x i32> %res
}

define <2 x i32> @intrinsic_llround_v2i32_v2f32(<2 x float> %arg) {
  ;CHECK: %res = tail call <2 x i32> @llvm.llround.v2i32.v2f32(<2 x float> %arg)
  %res = tail call <2 x i32> @llvm.llround.v2i32.v2f32(<2 x float> %arg)
  ret <2 x i32> %res
}

define <2 x i64> @intrinsic_lround_v2i64_v2f32(<2 x float> %arg) {
  ;CHECK: %res = tail call <2 x i64> @llvm.lround.v2i64.v2f32(<2 x float> %arg)
  %res = tail call <2 x i64> @llvm.lround.v2i64.v2f32(<2 x float> %arg)
  ret <2 x i64> %res
}

define <2 x i64> @intrinsic_llround_v2i64_v2f32(<2 x float> %arg) {
  ;CHECK: %res = tail call <2 x i64> @llvm.llround.v2i64.v2f32(<2 x float> %arg)
  %res = tail call <2 x i64> @llvm.llround.v2i64.v2f32(<2 x float> %arg)
  ret <2 x i64> %res
```

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


More information about the llvm-commits mailing list