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