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 4*9880d681SAndroid Build Coastguard Workerdeclare double @llvm.copysign.f64(double, double) nounwind readnone 5*9880d681SAndroid Build Coastguard Workerdeclare <2 x double> @llvm.copysign.v2f64(<2 x double>, <2 x double>) nounwind readnone 6*9880d681SAndroid Build Coastguard Workerdeclare <4 x double> @llvm.copysign.v4f64(<4 x double>, <4 x double>) nounwind readnone 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}test_copysign_f64: 9*9880d681SAndroid Build Coastguard Worker; SI-DAG: s_load_dwordx2 s{{\[}}[[SMAG_LO:[0-9]+]]:[[SMAG_HI:[0-9]+]]{{\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0xb 10*9880d681SAndroid Build Coastguard Worker; SI-DAG: s_load_dwordx2 s{{\[}}[[SSIGN_LO:[0-9]+]]:[[SSIGN_HI:[0-9]+]]{{\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0xd 11*9880d681SAndroid Build Coastguard Worker; VI-DAG: s_load_dwordx2 s{{\[}}[[SMAG_LO:[0-9]+]]:[[SMAG_HI:[0-9]+]]{{\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0x2c 12*9880d681SAndroid Build Coastguard Worker; VI-DAG: s_load_dwordx2 s{{\[}}[[SSIGN_LO:[0-9]+]]:[[SSIGN_HI:[0-9]+]]{{\]}}, s{{\[[0-9]+:[0-9]+\]}}, 0x34 13*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[VSIGN_HI:[0-9]+]], s[[SSIGN_HI]] 14*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[VMAG_HI:[0-9]+]], s[[SMAG_HI]] 15*9880d681SAndroid Build Coastguard Worker; GCN-DAG: s_mov_b32 [[SCONST:s[0-9]+]], 0x7fffffff 16*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_bfi_b32 v[[VRESULT_HI:[0-9]+]], [[SCONST]], v[[VMAG_HI]], v[[VSIGN_HI]] 17*9880d681SAndroid Build Coastguard Worker; GCN-DAG: v_mov_b32_e32 v[[VMAG_LO:[0-9]+]], s[[SMAG_LO]] 18*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2 v{{\[}}[[VMAG_LO]]:[[VRESULT_HI]]{{\]}} 19*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm 20*9880d681SAndroid Build Coastguard Workerdefine void @test_copysign_f64(double addrspace(1)* %out, double %mag, double %sign) nounwind { 21*9880d681SAndroid Build Coastguard Worker %result = call double @llvm.copysign.f64(double %mag, double %sign) 22*9880d681SAndroid Build Coastguard Worker store double %result, double addrspace(1)* %out, align 8 23*9880d681SAndroid Build Coastguard Worker ret void 24*9880d681SAndroid Build Coastguard Worker} 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}test_copysign_v2f64: 27*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm 28*9880d681SAndroid Build Coastguard Workerdefine void @test_copysign_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %mag, <2 x double> %sign) nounwind { 29*9880d681SAndroid Build Coastguard Worker %result = call <2 x double> @llvm.copysign.v2f64(<2 x double> %mag, <2 x double> %sign) 30*9880d681SAndroid Build Coastguard Worker store <2 x double> %result, <2 x double> addrspace(1)* %out, align 8 31*9880d681SAndroid Build Coastguard Worker ret void 32*9880d681SAndroid Build Coastguard Worker} 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}test_copysign_v4f64: 35*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm 36*9880d681SAndroid Build Coastguard Workerdefine void @test_copysign_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %mag, <4 x double> %sign) nounwind { 37*9880d681SAndroid Build Coastguard Worker %result = call <4 x double> @llvm.copysign.v4f64(<4 x double> %mag, <4 x double> %sign) 38*9880d681SAndroid Build Coastguard Worker store <4 x double> %result, <4 x double> addrspace(1)* %out, align 8 39*9880d681SAndroid Build Coastguard Worker ret void 40*9880d681SAndroid Build Coastguard Worker} 41