• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=GCN -check-prefix=FUNC %s
2; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=VI -check-prefix=GCN -check-prefix=FUNC %s
3; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
4
5declare float @llvm.copysign.f32(float, float) nounwind readnone
6declare <2 x float> @llvm.copysign.v2f32(<2 x float>, <2 x float>) nounwind readnone
7declare <4 x float> @llvm.copysign.v4f32(<4 x float>, <4 x float>) nounwind readnone
8
9; Try to identify arg based on higher address.
10; FUNC-LABEL: {{^}}test_copysign_f32:
11; SI: s_load_dwordx2 s{{\[}}[[SMAG:[0-9]+]]:[[SSIGN:[0-9]+]]{{\]}}, {{.*}} 0xb
12; VI: s_load_dwordx2 s{{\[}}[[SMAG:[0-9]+]]:[[SSIGN:[0-9]+]]{{\]}}, {{.*}} 0x2c
13
14; GCN-DAG: v_mov_b32_e32 [[VSIGN:v[0-9]+]], s[[SSIGN]]
15; GCN-DAG: v_mov_b32_e32 [[VMAG:v[0-9]+]], s[[SMAG]]
16; GCN-DAG: s_brev_b32 [[SCONST:s[0-9]+]], -2
17; GCN: v_bfi_b32 [[RESULT:v[0-9]+]], [[SCONST]], [[VMAG]], [[VSIGN]]
18; GCN: buffer_store_dword [[RESULT]],
19; GCN: s_endpgm
20
21; EG: BFI_INT
22define amdgpu_kernel void @test_copysign_f32(float addrspace(1)* %out, float %mag, float %sign) nounwind {
23  %result = call float @llvm.copysign.f32(float %mag, float %sign)
24  store float %result, float addrspace(1)* %out, align 4
25  ret void
26}
27
28; FUNC-LABEL: {{^}}test_copysign_v2f32:
29; GCN: s_endpgm
30
31; EG: BFI_INT
32; EG: BFI_INT
33define amdgpu_kernel void @test_copysign_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %mag, <2 x float> %sign) nounwind {
34  %result = call <2 x float> @llvm.copysign.v2f32(<2 x float> %mag, <2 x float> %sign)
35  store <2 x float> %result, <2 x float> addrspace(1)* %out, align 8
36  ret void
37}
38
39; FUNC-LABEL: {{^}}test_copysign_v4f32:
40; GCN: s_endpgm
41
42; EG: BFI_INT
43; EG: BFI_INT
44; EG: BFI_INT
45; EG: BFI_INT
46define amdgpu_kernel void @test_copysign_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %mag, <4 x float> %sign) nounwind {
47  %result = call <4 x float> @llvm.copysign.v4f32(<4 x float> %mag, <4 x float> %sign)
48  store <4 x float> %result, <4 x float> addrspace(1)* %out, align 16
49  ret void
50}
51
52