xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/fcopysign.f32.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=GCN -check-prefix=FUNC %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=VI -check-prefix=GCN -check-prefix=FUNC %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.copysign.f32(float, float) nounwind readnone
7*9880d681SAndroid Build Coastguard Workerdeclare <2 x float> @llvm.copysign.v2f32(<2 x float>, <2 x float>) nounwind readnone
8*9880d681SAndroid Build Coastguard Workerdeclare <4 x float> @llvm.copysign.v4f32(<4 x float>, <4 x float>) nounwind readnone
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; Try to identify arg based on higher address.
11*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}test_copysign_f32:
12*9880d681SAndroid Build Coastguard Worker; SI: s_load_dword [[SMAG:s[0-9]+]], {{.*}} 0xb
13*9880d681SAndroid Build Coastguard Worker; SI: s_load_dword [[SSIGN:s[0-9]+]], {{.*}} 0xc
14*9880d681SAndroid Build Coastguard Worker; VI: s_load_dword [[SMAG:s[0-9]+]], {{.*}} 0x2c
15*9880d681SAndroid Build Coastguard Worker; VI: s_load_dword [[SSIGN:s[0-9]+]], {{.*}} 0x30
16*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 [[VSIGN:v[0-9]+]], [[SSIGN]]
17*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 [[VMAG:v[0-9]+]], [[SMAG]]
18*9880d681SAndroid Build Coastguard Worker; GCN-DAG: s_mov_b32 [[SCONST:s[0-9]+]], 0x7fffffff
19*9880d681SAndroid Build Coastguard Worker; GCN: v_bfi_b32 [[RESULT:v[0-9]+]], [[SCONST]], [[VMAG]], [[VSIGN]]
20*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dword [[RESULT]],
21*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; EG: BFI_INT
24*9880d681SAndroid Build Coastguard Workerdefine void @test_copysign_f32(float addrspace(1)* %out, float %mag, float %sign) nounwind {
25*9880d681SAndroid Build Coastguard Worker  %result = call float @llvm.copysign.f32(float %mag, float %sign)
26*9880d681SAndroid Build Coastguard Worker  store float %result, float addrspace(1)* %out, align 4
27*9880d681SAndroid Build Coastguard Worker  ret void
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}test_copysign_v2f32:
31*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker; EG: BFI_INT
34*9880d681SAndroid Build Coastguard Worker; EG: BFI_INT
35*9880d681SAndroid Build Coastguard Workerdefine void @test_copysign_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %mag, <2 x float> %sign) nounwind {
36*9880d681SAndroid Build Coastguard Worker  %result = call <2 x float> @llvm.copysign.v2f32(<2 x float> %mag, <2 x float> %sign)
37*9880d681SAndroid Build Coastguard Worker  store <2 x float> %result, <2 x float> addrspace(1)* %out, align 8
38*9880d681SAndroid Build Coastguard Worker  ret void
39*9880d681SAndroid Build Coastguard Worker}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}test_copysign_v4f32:
42*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker; EG: BFI_INT
45*9880d681SAndroid Build Coastguard Worker; EG: BFI_INT
46*9880d681SAndroid Build Coastguard Worker; EG: BFI_INT
47*9880d681SAndroid Build Coastguard Worker; EG: BFI_INT
48*9880d681SAndroid Build Coastguard Workerdefine void @test_copysign_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %mag, <4 x float> %sign) nounwind {
49*9880d681SAndroid Build Coastguard Worker  %result = call <4 x float> @llvm.copysign.v4f32(<4 x float> %mag, <4 x float> %sign)
50*9880d681SAndroid Build Coastguard Worker  store <4 x float> %result, <4 x float> addrspace(1)* %out, align 16
51*9880d681SAndroid Build Coastguard Worker  ret void
52*9880d681SAndroid Build Coastguard Worker}
53*9880d681SAndroid Build Coastguard Worker
54