Home | History | Annotate | Download | only in R600
      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_sub_i32
     12 ; SI: s_max_i32
     13 ; SI: s_endpgm
     14 
     15 ; EG: SUB_INT
     16 ; EG: MAX_INT
     17 define void @s_abs_i32(i32 addrspace(1)* %out, i32 %src) nounwind {
     18   %abs = call i32 @llvm.AMDGPU.abs(i32 %src) nounwind readnone
     19   store i32 %abs, i32 addrspace(1)* %out, align 4
     20   ret void
     21 }
     22 
     23 ; FUNC-LABEL: {{^}}v_abs_i32:
     24 ; SI: v_sub_i32_e32
     25 ; SI: v_max_i32_e32
     26 ; SI: s_endpgm
     27 
     28 ; EG: SUB_INT
     29 ; EG: MAX_INT
     30 define void @v_abs_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %src) nounwind {
     31   %val = load i32, i32 addrspace(1)* %src, align 4
     32   %abs = call i32 @llvm.AMDGPU.abs(i32 %val) nounwind readnone
     33   store i32 %abs, i32 addrspace(1)* %out, align 4
     34   ret void
     35 }
     36 
     37 ; FUNC-LABEL: {{^}}abs_i32_legacy_amdil:
     38 ; SI: v_sub_i32_e32
     39 ; SI: v_max_i32_e32
     40 ; SI: s_endpgm
     41 
     42 ; EG: SUB_INT
     43 ; EG: MAX_INT
     44 define void @abs_i32_legacy_amdil(i32 addrspace(1)* %out, i32 addrspace(1)* %src) nounwind {
     45   %val = load i32, i32 addrspace(1)* %src, align 4
     46   %abs = call i32 @llvm.AMDIL.abs.i32(i32 %val) nounwind readnone
     47   store i32 %abs, i32 addrspace(1)* %out, align 4
     48   ret void
     49 }
     50