[llvm] [TTI] Add basic costs for llvm.[su]mulh. (PR #224002)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 04:06:16 PDT 2026


================
@@ -0,0 +1,125 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
----------------
davemgreen wrote:

Maybe just mulh.ll?

We usually do cost-model tests by scalar type, as it isn't just the legal types that are important. The tests are likely to need to change anyway and this seems like a good start. I think the i64 costs are mostly likely to need to change (be different from the rest, as we did for multiply on v3ae), and it can be nice if they are separate to keep the auto-generated lines down.

```
  %V2I8  = call <2 x i8> @llvm.abs.v2i8(<2 x i8> undef, i1 false)
  %V4I8  = call <4 x i8> @llvm.abs.v4i8(<4 x i8> undef, i1 false)
  %V8I8  = call <8 x i8> @llvm.abs.v8i8(<8 x i8> undef, i1 false)
  %V16I8 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> undef, i1 false)
  %V32I8 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> undef, i1 false)
  %V64I8 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> undef, i1 false)

  %V2I16  = call <2 x i16> @llvm.abs.v2i16(<2 x i16> undef, i1 false)
  %V4I16  = call <4 x i16> @llvm.abs.v4i16(<4 x i16> undef, i1 false)
  %V8I16  = call <8 x i16> @llvm.abs.v8i16(<8 x i16> undef, i1 false)
  %V16I16 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> undef, i1 false)
  %V32I16 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> undef, i1 false)

  %V2I32  = call <2 x i32> @llvm.abs.v2i32(<2 x i32> undef, i1 false)
  %V4I32  = call <4 x i32> @llvm.abs.v4i32(<4 x i32> undef, i1 false)
  %V8I32  = call <8 x i32> @llvm.abs.v8i32(<8 x i32> undef, i1 false)
  %V16I32 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> undef, i1 false)

  %V2I64 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> undef, i1 false)
  %V4I64 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> undef, i1 false)
  %V8I64 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> undef, i1 false)

  %V2I128 = call <2 x i128> @llvm.abs.v2i128(<2 x i128> undef, i1 false)
```

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


More information about the llvm-commits mailing list