Module: Mesa
Branch: main
Commit: 8e97d291a8fdc96528dd5d720d418be24d189ea5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e97d291a8fdc96528dd5d720d418be24d189ea5

Author: Marek Olšák <[email protected]>
Date:   Tue Sep 26 00:28:36 2023 -0400

ac/llvm: replace removed amdgcn.ldexp for LLVM 18

Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25393>

---

 src/amd/llvm/ac_nir_to_llvm.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 67bb555a50d..2583544040b 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -860,14 +860,20 @@ static bool visit_alu(struct ac_nir_context *ctx, const 
nir_alu_instr *instr)
    case nir_op_ldexp:
       src[0] = ac_to_float(&ctx->ac, src[0]);
       if (ac_get_elem_bits(&ctx->ac, def_type) == 32)
-         result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.ldexp.f32", 
ctx->ac.f32, src, 2,
-                                     0);
+         result = ac_build_intrinsic(&ctx->ac,
+                                     LLVM_VERSION_MAJOR >= 18 ? 
"llvm.ldexp.f32.i32"
+                                                              : 
"llvm.amdgcn.ldexp.f32",
+                                     ctx->ac.f32, src, 2, 0);
       else if (ac_get_elem_bits(&ctx->ac, def_type) == 16)
-         result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.ldexp.f16", 
ctx->ac.f16, src, 2,
-                                     0);
+         result = ac_build_intrinsic(&ctx->ac,
+                                     LLVM_VERSION_MAJOR >= 18 ? 
"llvm.ldexp.f16.i32"
+                                                              : 
"llvm.amdgcn.ldexp.f16",
+                                     ctx->ac.f16, src, 2, 0);
       else
-         result = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.ldexp.f64", 
ctx->ac.f64, src, 2,
-                                     0);
+         result = ac_build_intrinsic(&ctx->ac,
+                                     LLVM_VERSION_MAJOR >= 18 ? 
"llvm.ldexp.f64.i32"
+                                                              : 
"llvm.amdgcn.ldexp.f64",
+                                     ctx->ac.f64, src, 2, 0);
       break;
    case nir_op_bfm:
       result = emit_bfm(&ctx->ac, src[0], src[1]);

Reply via email to