2016-04-15 05:58:07 +08:00
|
|
|
;RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck --check-prefix=SI --check-prefix=GCN --check-prefix=FUNC %s
|
2017-01-25 06:02:15 +08:00
|
|
|
;RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefix=VI --check-prefix=GCN --check-prefix=FUNC %s
|
2015-01-23 07:42:43 +08:00
|
|
|
;RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck --check-prefix=EG --check-prefix=FUNC %s
|
|
|
|
|
2016-04-15 05:58:07 +08:00
|
|
|
;FUNC-LABEL: {{^}}s_test_sdiv:
|
2015-01-23 07:42:43 +08:00
|
|
|
;EG: RECIP_UINT
|
|
|
|
;EG: LSHL {{.*}}, 1,
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
|
2017-10-07 01:24:45 +08:00
|
|
|
;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0x4f800000,
|
|
|
|
;GCN: v_rcp_f32_e32
|
|
|
|
;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x5f7ffffc
|
|
|
|
;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x2f800000
|
|
|
|
;GCN: v_trunc_f32_e32
|
|
|
|
;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0xcf800000
|
|
|
|
;GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @s_test_sdiv(i64 addrspace(1)* %out, i64 %x, i64 %y) {
|
2015-01-23 07:42:43 +08:00
|
|
|
%result = sdiv i64 %x, %y
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-04-15 05:58:07 +08:00
|
|
|
;FUNC-LABEL: {{^}}s_test_srem:
|
2015-01-23 07:42:43 +08:00
|
|
|
;EG: RECIP_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: BFE_UINT
|
|
|
|
;EG: AND_INT {{.*}}, 1,
|
|
|
|
|
2017-10-07 01:24:45 +08:00
|
|
|
;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0x4f800000,
|
|
|
|
;GCN: v_rcp_f32_e32
|
|
|
|
;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x5f7ffffc
|
|
|
|
;GCN: v_mul_f32_e32 v{{[0-9]+}}, 0x2f800000
|
|
|
|
;GCN: v_trunc_f32_e32
|
|
|
|
;GCN: v_mac_f32_e32 v{{[0-9]+}}, 0xcf800000
|
2015-02-11 22:26:46 +08:00
|
|
|
;GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @s_test_srem(i64 addrspace(1)* %out, i64 %x, i64 %y) {
|
2015-01-23 07:42:43 +08:00
|
|
|
%result = urem i64 %x, %y
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
;FUNC-LABEL: {{^}}test_sdiv3264:
|
|
|
|
;EG: RECIP_UINT
|
|
|
|
;EG-NOT: BFE_UINT
|
|
|
|
|
2015-02-11 22:26:46 +08:00
|
|
|
;GCN-NOT: s_bfe_u32
|
|
|
|
;GCN-NOT: v_mad_f32
|
|
|
|
;SI-NOT: v_lshr_b64
|
|
|
|
;VI-NOT: v_lshrrev_b64
|
|
|
|
;GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_sdiv3264(i64 addrspace(1)* %out, i64 %x, i64 %y) {
|
2015-01-23 07:42:43 +08:00
|
|
|
%1 = ashr i64 %x, 33
|
|
|
|
%2 = ashr i64 %y, 33
|
|
|
|
%result = sdiv i64 %1, %2
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
;FUNC-LABEL: {{^}}test_srem3264:
|
|
|
|
;EG: RECIP_UINT
|
|
|
|
;EG-NOT: BFE_UINT
|
|
|
|
|
2015-02-11 22:26:46 +08:00
|
|
|
;GCN-NOT: s_bfe_u32
|
|
|
|
;GCN-NOT: v_mad_f32
|
|
|
|
;SI-NOT: v_lshr_b64
|
|
|
|
;VI-NOT: v_lshrrev_b64
|
|
|
|
;GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_srem3264(i64 addrspace(1)* %out, i64 %x, i64 %y) {
|
2015-01-23 07:42:43 +08:00
|
|
|
%1 = ashr i64 %x, 33
|
|
|
|
%2 = ashr i64 %y, 33
|
|
|
|
%result = srem i64 %1, %2
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
;FUNC-LABEL: {{^}}test_sdiv2464:
|
|
|
|
;EG: INT_TO_FLT
|
|
|
|
;EG: INT_TO_FLT
|
|
|
|
;EG: FLT_TO_INT
|
|
|
|
;EG-NOT: RECIP_UINT
|
|
|
|
;EG-NOT: BFE_UINT
|
|
|
|
|
2015-02-11 22:26:46 +08:00
|
|
|
;GCN-NOT: s_bfe_u32
|
|
|
|
;GCN: v_mad_f32
|
|
|
|
;SI-NOT: v_lshr_b64
|
|
|
|
;VI-NOT: v_lshrrev_b64
|
|
|
|
;GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_sdiv2464(i64 addrspace(1)* %out, i64 %x, i64 %y) {
|
2015-01-23 07:42:43 +08:00
|
|
|
%1 = ashr i64 %x, 40
|
|
|
|
%2 = ashr i64 %y, 40
|
|
|
|
%result = sdiv i64 %1, %2
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
;FUNC-LABEL: {{^}}test_srem2464:
|
|
|
|
;EG: INT_TO_FLT
|
|
|
|
;EG: INT_TO_FLT
|
|
|
|
;EG: FLT_TO_INT
|
|
|
|
;EG-NOT: RECIP_UINT
|
|
|
|
;EG-NOT: BFE_UINT
|
|
|
|
|
2015-02-11 22:26:46 +08:00
|
|
|
;GCN-NOT: s_bfe_u32
|
|
|
|
;GCN: v_mad_f32
|
|
|
|
;SI-NOT: v_lshr_b64
|
|
|
|
;VI-NOT: v_lshrrev_b64
|
|
|
|
;GCN: s_endpgm
|
2017-03-22 05:39:51 +08:00
|
|
|
define amdgpu_kernel void @test_srem2464(i64 addrspace(1)* %out, i64 %x, i64 %y) {
|
2015-01-23 07:42:43 +08:00
|
|
|
%1 = ashr i64 %x, 40
|
|
|
|
%2 = ashr i64 %y, 40
|
|
|
|
%result = srem i64 %1, %2
|
|
|
|
store i64 %result, i64 addrspace(1)* %out
|
|
|
|
ret void
|
|
|
|
}
|