[llvm] r251630 - AMDGPU/SI: use S_AND for i1 trunc
Christian König via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 29 08:12:27 PDT 2015
On 29.10.2015 16:05, Marek Olsak via llvm-commits wrote:
> Author: mareko
> Date: Thu Oct 29 10:05:03 2015
> New Revision: 251630
>
> URL: http://llvm.org/viewvc/llvm-project?rev=251630&view=rev
> Log:
> AMDGPU/SI: use S_AND for i1 trunc
>
> Modified:
> llvm/trunk/lib/Target/AMDGPU/SIInstructions.td
> llvm/trunk/test/CodeGen/AMDGPU/trunc.ll
>
> Modified: llvm/trunk/lib/Target/AMDGPU/SIInstructions.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIInstructions.td?rev=251630&r1=251629&r2=251630&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/AMDGPU/SIInstructions.td (original)
> +++ llvm/trunk/lib/Target/AMDGPU/SIInstructions.td Thu Oct 29 10:05:03 2015
> @@ -3183,12 +3183,12 @@ def : Pat <
>
> def : Pat <
> (i1 (trunc i32:$a)),
> - (V_CMP_EQ_I32_e64 (V_AND_B32_e64 (i32 1), $a), 1)
> + (V_CMP_EQ_I32_e64 (S_AND_B32 (i32 1), $a), 1)
> >;
Maybe a dump question, but wouldn't do a compare for greater than zero
do the same in just one instruction instead of two?
Christian.
>
> def : Pat <
> (i1 (trunc i64:$a)),
> - (V_CMP_EQ_I32_e64 (V_AND_B32_e64 (i32 1),
> + (V_CMP_EQ_I32_e64 (S_AND_B32 (i32 1),
> (EXTRACT_SUBREG $a, sub0)), 1)
> >;
>
>
> Modified: llvm/trunk/test/CodeGen/AMDGPU/trunc.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/trunc.ll?rev=251630&r1=251629&r2=251630&view=diff
> ==============================================================================
> --- llvm/trunk/test/CodeGen/AMDGPU/trunc.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/trunc.ll Thu Oct 29 10:05:03 2015
> @@ -61,7 +61,7 @@ define void @trunc_i32_to_i1(i32 addrspa
> }
>
> ; SI-LABEL: {{^}}sgpr_trunc_i32_to_i1:
> -; SI: v_and_b32_e64 v{{[0-9]+}}, 1, s{{[0-9]+}}
> +; SI: s_and_b32 s{{[0-9]+}}, 1, s{{[0-9]+}}
> ; SI: v_cmp_eq_i32
> define void @sgpr_trunc_i32_to_i1(i32 addrspace(1)* %out, i32 %a) {
> %trunc = trunc i32 %a to i1
> @@ -72,9 +72,9 @@ define void @sgpr_trunc_i32_to_i1(i32 ad
>
> ; SI-LABEL: {{^}}s_trunc_i64_to_i1:
> ; SI: s_load_dwordx2 s{{\[}}[[SLO:[0-9]+]]:{{[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}, 0xb
> -; SI: v_and_b32_e64 [[MASKED:v[0-9]+]], 1, s[[SLO]]
> -; SI: v_cmp_eq_i32_e32 vcc, 1, [[MASKED]]
> -; SI: v_cndmask_b32_e64 {{v[0-9]+}}, -12, 63, vcc
> +; SI: s_and_b32 [[MASKED:s[0-9]+]], 1, s[[SLO]]
> +; SI: v_cmp_eq_i32_e64 s{{\[}}[[VLO:[0-9]+]]:[[VHI:[0-9]+]]], 1, [[MASKED]]
> +; SI: v_cndmask_b32_e64 {{v[0-9]+}}, -12, 63, s{{\[}}[[VLO]]:[[VHI]]]
> define void @s_trunc_i64_to_i1(i32 addrspace(1)* %out, i64 %x) {
> %trunc = trunc i64 %x to i1
> %sel = select i1 %trunc, i32 63, i32 -12
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list