[clang] [CIR][AMDGPU] Add support for AMDGCN fcmp builtins (PR #198135)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 09:28:09 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 92089 tests passed
* 851 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.CIR/CodeGenHIP/builtins-amdgcn.hip</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir             -target-cpu tahiti -fcuda-is-device -emit-cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir -target-cpu tahiti -fcuda-is-device -emit-cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CIR --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CIR --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# note: command had no output on stdout or stderr
# RUN: at line 6
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir             -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll
# note: command had no output on stdout or stderr
# RUN: at line 8
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# note: command had no output on stdout or stderr
# RUN: at line 10
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11             -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll
# note: command had no output on stdout or stderr
# RUN: at line 12
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip:78:10: error: LLVM: expected string not found in input
# | // LLVM: call{{.*}} i64 @llvm.amdgcn.fcmp.i64.f32(float %{{.*}}, float %{{.*}}, i32 5)
# |          ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll:201:45: note: scanning from here
# | define dso_local void @_Z13test_fcmp_f32Pyff(ptr noundef %out, float noundef %a, float noundef %b) #0 {
# |                                             ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll:263:16: note: possible intended match here
# |  %3 = call contract float @llvm.amdgcn.div.fixup.f32(float %0, float %1, float %2)
# |                ^
# | 
# | Input file: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           196:  
# |           197: ; Function Attrs: convergent nocallback nofree nounwind willreturn memory(none) 
# |           198: declare i32 @llvm.amdgcn.ds.swizzle(i32, i32 immarg) #2 
# |           199:  
# |           200: ; Function Attrs: convergent mustprogress noinline nounwind optnone 
# |           201: define dso_local void @_Z13test_fcmp_f32Pyff(ptr noundef %out, float noundef %a, float noundef %b) #0 { 
# | check:78'0                                                {                                                              search range start (exclusive)
# | check:78'1                                                                                                               error: no match found in search range
# |           202: entry: 
# |           203:  %out.addr = alloca ptr, align 8, addrspace(5) 
# |           204:  %a.addr = alloca float, align 4, addrspace(5) 
# |           205:  %b.addr = alloca float, align 4, addrspace(5) 
# |           206:  %out.addr.ascast = addrspacecast ptr addrspace(5) %out.addr to ptr 
# |             .
# |             .
# |             .
# |           258:  store float %b, ptr %b.addr.ascast, align 4 
# |           259:  store float %c, ptr %c.addr.ascast, align 4 
# |           260:  %0 = load float, ptr %a.addr.ascast, align 4 
# |           261:  %1 = load float, ptr %b.addr.ascast, align 4 
# |           262:  %2 = load float, ptr %c.addr.ascast, align 4 
# |           263:  %3 = call contract float @llvm.amdgcn.div.fixup.f32(float %0, float %1, float %2) 
# | check:78'2                    ?                                                                     possible intended match
# |           264:  %4 = load ptr, ptr %out.addr.ascast, align 8 
# |           265:  store float %3, ptr %4, align 4 
# |           266:  ret void 
# |           267: } 
# |           268:  
# |             .
# |             .
# |             .
# |           337:  
# |           338: ; Function Attrs: convergent nocallback nocreateundeforpoison nofree nounwind willreturn memory(none) 
# |           339: declare i32 @llvm.amdgcn.readfirstlane.i32(i32) #3 
# |           340:  
# |           341: ; Function Attrs: convergent mustprogress noinline nounwind optnone 
# |           342: define dso_local void @_Z17test_dispatch_ptrPPU3AS4v(ptr noundef %out) #0 { 
# | check:78'3                                                 }                                 search range end (exclusive)
# |           343: entry: 
# |           344:  %out.addr = alloca ptr, align 8, addrspace(5) 
# |           345:  %out.addr.ascast = addrspacecast ptr addrspace(5) %out.addr to ptr 
# |           346:  store ptr %out, ptr %out.addr.ascast, align 8 
# |           347:  %0 = call ptr addrspace(4) @llvm.amdgcn.dispatch.ptr() 
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Clang.CIR/CodeGenHIP/builtins-amdgcn.hip</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir             -target-cpu tahiti -fcuda-is-device -emit-cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir -target-cpu tahiti -fcuda-is-device -emit-cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CIR --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CIR --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.cir /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# note: command had no output on stdout or stderr
# RUN: at line 6
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir             -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -fclangir -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll
# note: command had no output on stdout or stderr
# RUN: at line 8
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp-cir.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# note: command had no output on stdout or stderr
# RUN: at line 10
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11             -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple amdgcn-amd-amdhsa -x hip -std=c++11 -target-cpu tahiti -fcuda-is-device -emit-llvm /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll
# note: command had no output on stdout or stderr
# RUN: at line 12
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=LLVM --input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip:78:10: error: LLVM: expected string not found in input
# | // LLVM: call{{.*}} i64 @llvm.amdgcn.fcmp.i64.f32(float %{{.*}}, float %{{.*}}, i32 5)
# |          ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll:201:45: note: scanning from here
# | define dso_local void @_Z13test_fcmp_f32Pyff(ptr noundef %out, float noundef %a, float noundef %b) #0 {
# |                                             ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll:263:16: note: possible intended match here
# |  %3 = call contract float @llvm.amdgcn.div.fixup.f32(float %0, float %1, float %2)
# |                ^
# | 
# | Input file: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenHIP/Output/builtins-amdgcn.hip.tmp.ll
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           196:  
# |           197: ; Function Attrs: convergent nocallback nofree nounwind willreturn memory(none) 
# |           198: declare i32 @llvm.amdgcn.ds.swizzle(i32, i32 immarg) #2 
# |           199:  
# |           200: ; Function Attrs: convergent mustprogress noinline nounwind optnone 
# |           201: define dso_local void @_Z13test_fcmp_f32Pyff(ptr noundef %out, float noundef %a, float noundef %b) #0 { 
# | check:78'0                                                {                                                              search range start (exclusive)
# | check:78'1                                                                                                               error: no match found in search range
# |           202: entry: 
# |           203:  %out.addr = alloca ptr, align 8, addrspace(5) 
# |           204:  %a.addr = alloca float, align 4, addrspace(5) 
# |           205:  %b.addr = alloca float, align 4, addrspace(5) 
# |           206:  %out.addr.ascast = addrspacecast ptr addrspace(5) %out.addr to ptr 
# |             .
# |             .
# |             .
# |           258:  store float %b, ptr %b.addr.ascast, align 4 
# |           259:  store float %c, ptr %c.addr.ascast, align 4 
# |           260:  %0 = load float, ptr %a.addr.ascast, align 4 
# |           261:  %1 = load float, ptr %b.addr.ascast, align 4 
# |           262:  %2 = load float, ptr %c.addr.ascast, align 4 
# |           263:  %3 = call contract float @llvm.amdgcn.div.fixup.f32(float %0, float %1, float %2) 
# | check:78'2                    ?                                                                     possible intended match
# |           264:  %4 = load ptr, ptr %out.addr.ascast, align 8 
# |           265:  store float %3, ptr %4, align 4 
# |           266:  ret void 
# |           267: } 
# |           268:  
# |             .
# |             .
# |             .
# |           337:  
# |           338: ; Function Attrs: convergent nocallback nocreateundeforpoison nofree nounwind willreturn memory(none) 
# |           339: declare i32 @llvm.amdgcn.readfirstlane.i32(i32) #3 
# |           340:  
# |           341: ; Function Attrs: convergent mustprogress noinline nounwind optnone 
# |           342: define dso_local void @_Z17test_dispatch_ptrPPU3AS4v(ptr noundef %out) #0 { 
# | check:78'3                                                 }                                 search range end (exclusive)
# |           343: entry: 
# |           344:  %out.addr = alloca ptr, align 8, addrspace(5) 
# |           345:  %out.addr.ascast = addrspacecast ptr addrspace(5) %out.addr to ptr 
# |           346:  store ptr %out, ptr %out.addr.ascast, align 8 
# |           347:  %0 = call ptr addrspace(4) @llvm.amdgcn.dispatch.ptr() 
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the cfe-commits mailing list