[all-commits] [llvm/llvm-project] 3fd0ea: [libclc][amdgpu] Implement native_exp2 via AMD bui...

Fraser Cormack via All-commits all-commits at lists.llvm.org
Mon Mar 31 08:54:26 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3fd0eaae52503ee2bbdffc75753acc4bcc72fe60
      https://github.com/llvm/llvm-project/commit/3fd0eaae52503ee2bbdffc75753acc4bcc72fe60
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2025-03-31 (Mon, 31 Mar 2025)

  Changed paths:
    M libclc/amdgpu/lib/SOURCES
    A libclc/amdgpu/lib/math/native_exp2.cl

  Log Message:
  -----------
  [libclc][amdgpu] Implement native_exp2 via AMD builtin (#133696)

This came up during a discussion on #129679, which has been split out as
a preparatory commit.

An example of the AMDGPU codegen is:

    define <2 x float> @_Z10native_expDv2_f(<2 x float> %val) {
      %mul = fmul afn <2 x float> %val, splat (float 0x3FF7154760000000)
      %0 = extractelement <2 x float> %mul, i64 0
      %1 = tail call float @llvm.amdgcn.exp2.f32(float %0)
      %vecinit.i = insertelement <2 x float> poison, float %1, i64 0
      %2 = extractelement <2 x float> %mul, i64 1
      %3 = tail call float @llvm.amdgcn.exp2.f32(float %2)
%vecinit2.i = insertelement <2 x float> %vecinit.i, float %3, i64 1
      ret <2 x float> %vecinit2.i
    }

    define <2 x float> @_Z11native_exp2Dv2_f(<2 x float> %x) {
      %0 = extractelement <2 x float> %x, i64 0
      %1 = tail call float @llvm.amdgcn.exp2.f32(float %0)
      %vecinit = insertelement <2 x float> poison, float %1, i64 0
      %2 = extractelement <2 x float> %x, i64 1
      %3 = tail call float @llvm.amdgcn.exp2.f32(float %2)
      %vecinit2 = insertelement <2 x float> %vecinit, float %3, i64 1
      ret <2 x float> %vecinit2
    }



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list