[llvm] [NVPTX] Improve support for {ex2,lg2}.approx (PR #120519)

Princeton Ferro via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 24 10:43:56 PST 2024


================
@@ -964,6 +964,10 @@ let TargetPrefix = "nvvm" in {
       DefaultAttrsIntrinsic<[llvm_half_ty], [llvm_half_ty], [IntrNoMem]>;
   def int_nvvm_ex2_approx_f16x2 :
       DefaultAttrsIntrinsic<[llvm_v2f16_ty], [llvm_v2f16_ty], [IntrNoMem]>;
+  def int_nvvm_ex2_approx_bf16 :
+      DefaultAttrsIntrinsic<[llvm_bfloat_ty], [llvm_bfloat_ty], [IntrNoMem]>;
+  def int_nvvm_ex2_approx_bf16x2 :
+      DefaultAttrsIntrinsic<[llvm_v2bf16_ty], [llvm_v2bf16_ty], [IntrNoMem]>;
----------------
Prince781 wrote:

I think for `log2` we should support `afn` to codegen to `lg2.approx`. But for `exp2`, `afn` wouldn't change anything. And the NVVM intrinsics seem to have convention for suffix names for types (`.f` -> `float`, `.f16x2` -> `<2 x half>`, etc) that I can't achieve by using overloading, so I extended them with the same convention.

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


More information about the llvm-commits mailing list