1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2 ; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s 3 4 declare i32 @llvm.AMDGPU.abs(i32) nounwind readnone 5 6 ; Legacy name 7 declare i32 @llvm.AMDIL.abs.i32(i32) nounwind readnone 8 9 ; FUNC-LABEL: @s_abs_i32 10 ; SI: S_SUB_I32 11 ; SI: S_MAX_I32 12 ; SI: S_ENDPGM 13 14 ; EG: SUB_INT 15 ; EG: MAX_INT 16 define void @s_abs_i32(i32 addrspace(1)* %out, i32 %src) nounwind { 17 %abs = call i32 @llvm.AMDGPU.abs(i32 %src) nounwind readnone 18 store i32 %abs, i32 addrspace(1)* %out, align 4 19 ret void 20 } 21 22 ; FUNC-LABEL: @v_abs_i32 23 ; SI: V_SUB_I32_e32 24 ; SI: V_MAX_I32_e32 25 ; SI: S_ENDPGM 26 27 ; EG: SUB_INT 28 ; EG: MAX_INT 29 define void @v_abs_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %src) nounwind { 30 %val = load i32 addrspace(1)* %src, align 4 31 %abs = call i32 @llvm.AMDGPU.abs(i32 %val) nounwind readnone 32 store i32 %abs, i32 addrspace(1)* %out, align 4 33 ret void 34 } 35 36 ; FUNC-LABEL: @abs_i32_legacy_amdil 37 ; SI: V_SUB_I32_e32 38 ; SI: V_MAX_I32_e32 39 ; SI: S_ENDPGM 40 41 ; EG: SUB_INT 42 ; EG: MAX_INT 43 define void @abs_i32_legacy_amdil(i32 addrspace(1)* %out, i32 addrspace(1)* %src) nounwind { 44 %val = load i32 addrspace(1)* %src, align 4 45 %abs = call i32 @llvm.AMDIL.abs.i32(i32 %val) nounwind readnone 46 store i32 %abs, i32 addrspace(1)* %out, align 4 47 ret void 48 } 49