[clang] [CIR][AMDGPU] Adds amdgcn logb and scalebn builtins (PR #191344)
Rana Pratap Reddy via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 16 23:16:31 PDT 2026
================
@@ -0,0 +1,54 @@
+#include "../CodeGenCUDA/Inputs/cuda.h"
+
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir \
+// RUN: -target-cpu gfx1100 -fcuda-is-device -emit-cir %s -o %t.cir
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir \
+// RUN: -target-cpu gfx1100 -fcuda-is-device -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
+
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -std=c++11 \
+// RUN: -target-cpu gfx1100 -fcuda-is-device -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
+
+// CIR-LABEL: @_Z11test_logbfff
+// CIR: cir.call @logbf({{.*}}){{.*}}: (!cir.float{{.*}}) -> !cir.float
----------------
ranapratap55 wrote:
Thanks for this.
Added `shouldEmitBuiltinAsIR` and `supportsLibCall()`. Now CIR and CIR-lowered LLVM produce the same inline intrinsics (`llvm.frexp, llvm.ldexp`), so test uses a single LLVM check prefix for both paths.
https://github.com/llvm/llvm-project/pull/191344
More information about the cfe-commits
mailing list