1 ; RUN: llc -stop-after=amdgpu-isel -mtriple=amdgcn-- -mcpu=gfx1100 -verify-machineinstrs -o - %s | FileCheck --check-prefixes=CHECK,ISEL %s
2 ; RUN: not --crash llc -mtriple=amdgcn--amdhsa -mcpu=1100 -verify-machineinstrs < %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s
4 ; FIXME: Merge these tests with existing lane op tests (llvm.amdgcn.readlane.ll, llvm.amdgcn.writelane.ll ...) once the crash is fixed.
6 ; CHECK-LABEL: name: basic_readfirstlane_i64
7 ; CHECK: [[TOKEN:%[0-9]+]]{{[^ ]*}} = CONVERGENCECTRL_ANCHOR
8 ; ISEL: CONVERGENCECTRL_GLUE [[TOKEN]]
9 ; ISEL: {{.*}} = V_READFIRSTLANE_B32 {{.*}}, implicit [[TOKEN]]
10 ; ISEL: CONVERGENCECTRL_GLUE [[TOKEN]]
11 ; ISEL: {{.*}} = V_READFIRSTLANE_B32 {{.*}}, implicit [[TOKEN]]
12 define i64 @basic_readfirstlane_i64(i64 %src, i1 %cond) #0 {
14 %t = call token @llvm.experimental.convergence.anchor()
16 br i1 %cond, label %then, label %else
19 ; CHECK-ERROR: Cannot mix controlled and uncontrolled convergence in the same function.
20 ; CHECK-ERROR: V_READFIRSTLANE_B32
21 %r = call i64 @llvm.amdgcn.readfirstlane.i64(i64 %x) [ "convergencectrl"(token %t) ]
25 %p = phi i64 [%r, %then], [%x, %entry]
29 ; CHECK-LABEL: name: basic_readlane_i64
30 ; CHECK: [[TOKEN:%[0-9]+]]{{[^ ]*}} = CONVERGENCECTRL_ANCHOR
31 ; ISEL: CONVERGENCECTRL_GLUE [[TOKEN]]
32 ; ISEL: {{.*}} = V_READLANE_B32 {{.*}}, implicit [[TOKEN]]
33 ; ISEL: CONVERGENCECTRL_GLUE [[TOKEN]]
34 ; ISEL: {{.*}} = V_READLANE_B32 {{.*}}, implicit [[TOKEN]]
35 define i64 @basic_readlane_i64(i64 %src, i32 %lane, i1 %cond) #0 {
37 %t = call token @llvm.experimental.convergence.anchor()
39 br i1 %cond, label %then, label %else
42 %r = call i64 @llvm.amdgcn.readlane.i64(i64 %x, i32 %lane) [ "convergencectrl"(token %t) ]
46 %p = phi i64 [%r, %then], [%x, %entry]
50 ; CHECK-LABEL: name: basic_writelane_i64
51 ; CHECK: [[TOKEN:%[0-9]+]]{{[^ ]*}} = CONVERGENCECTRL_ANCHOR
52 ; ISEL: CONVERGENCECTRL_GLUE [[TOKEN]]
53 ; ISEL: {{.*}} = V_WRITELANE_B32 {{.*}}, implicit [[TOKEN]]
54 ; ISEL: CONVERGENCECTRL_GLUE [[TOKEN]]
55 ; ISEL: {{.*}} = V_WRITELANE_B32 {{.*}}, implicit [[TOKEN]]
56 define i64 @basic_writelane_i64(i64 %src, i1 %cond, i32 %lane, ptr addrspace(1) %out) #0 {
58 %old = load i64, ptr addrspace(1) %out
59 %t = call token @llvm.experimental.convergence.anchor()
61 br i1 %cond, label %then, label %else
64 %r = call i64 @llvm.amdgcn.writelane.i64(i64 %x, i32 %lane, i64 %old) [ "convergencectrl"(token %t) ]
68 %p = phi i64 [%r, %then], [%x, %entry]