xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.trig.preop.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.amdgcn.trig.preop.f64(double, i32) nounwind readnone
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; SI-LABEL: {{^}}test_trig_preop_f64:
7*9880d681SAndroid Build Coastguard Worker; SI-DAG: buffer_load_dword [[SEG:v[0-9]+]]
8*9880d681SAndroid Build Coastguard Worker; SI-DAG: buffer_load_dwordx2 [[SRC:v\[[0-9]+:[0-9]+\]]],
9*9880d681SAndroid Build Coastguard Worker; SI: v_trig_preop_f64 [[RESULT:v\[[0-9]+:[0-9]+\]]], [[SRC]], [[SEG]]
10*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dwordx2 [[RESULT]],
11*9880d681SAndroid Build Coastguard Worker; SI: s_endpgm
12*9880d681SAndroid Build Coastguard Workerdefine void @test_trig_preop_f64(double addrspace(1)* %out, double addrspace(1)* %aptr, i32 addrspace(1)* %bptr) nounwind {
13*9880d681SAndroid Build Coastguard Worker  %a = load double, double addrspace(1)* %aptr, align 8
14*9880d681SAndroid Build Coastguard Worker  %b = load i32, i32 addrspace(1)* %bptr, align 4
15*9880d681SAndroid Build Coastguard Worker  %result = call double @llvm.amdgcn.trig.preop.f64(double %a, i32 %b) nounwind readnone
16*9880d681SAndroid Build Coastguard Worker  store double %result, double addrspace(1)* %out, align 8
17*9880d681SAndroid Build Coastguard Worker  ret void
18*9880d681SAndroid Build Coastguard Worker}
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; SI-LABEL: {{^}}test_trig_preop_f64_imm_segment:
21*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dwordx2 [[SRC:v\[[0-9]+:[0-9]+\]]],
22*9880d681SAndroid Build Coastguard Worker; SI: v_trig_preop_f64 [[RESULT:v\[[0-9]+:[0-9]+\]]], [[SRC]], 7
23*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dwordx2 [[RESULT]],
24*9880d681SAndroid Build Coastguard Worker; SI: s_endpgm
25*9880d681SAndroid Build Coastguard Workerdefine void @test_trig_preop_f64_imm_segment(double addrspace(1)* %out, double addrspace(1)* %aptr) nounwind {
26*9880d681SAndroid Build Coastguard Worker  %a = load double, double addrspace(1)* %aptr, align 8
27*9880d681SAndroid Build Coastguard Worker  %result = call double @llvm.amdgcn.trig.preop.f64(double %a, i32 7) nounwind readnone
28*9880d681SAndroid Build Coastguard Worker  store double %result, double addrspace(1)* %out, align 8
29*9880d681SAndroid Build Coastguard Worker  ret void
30*9880d681SAndroid Build Coastguard Worker}
31