[Mesa-dev] [PATCH 11/14] R600/SI: add OMOD patterns

Michel Dänzer michel at daenzer.net
Thu Feb 21 00:26:51 PST 2013


On Mit, 2013-02-20 at 18:46 +0100, Christian König wrote: 
>  
> diff --git a/lib/Target/R600/SIInstructions.td b/lib/Target/R600/SIInstructions.td
> index 833e6cd..7c157e9 100644
> --- a/lib/Target/R600/SIInstructions.td
> +++ b/lib/Target/R600/SIInstructions.td
> @@ -1232,6 +1232,24 @@ def : Pat <
>     0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */)
>  >;
>  
> +def : Pat <
> +  (fmul VReg_32:$src, (f32 FP_0_5)),
> +  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
> +   0 /* ABS */, 0 /* CLAMP */, 3 /* OMOD */, 0 /* NEG */)
> +>;
> +
> +def : Pat <
> +  (fmul VReg_32:$src, (f32 FP_TWO)),
> +  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
> +   0 /* ABS */, 0 /* CLAMP */, 1 /* OMOD */, 0 /* NEG */)
> +>;
> +
> +def : Pat <
> +  (fmul VReg_32:$src, (f32 FP_FOUR)),
> +  (V_ADD_F32_e64 VReg_32:$src, (i32 0x80 /* SRC1 */),
> +   0 /* ABS */, 0 /* CLAMP */, 2 /* OMOD */, 0 /* NEG */)
> +>;

Is there any advantage to doing it like this as opposed to using
V_MUL_F32_e32 with the corresponding inline constant source operands? I
guess it could work for SGPRs as the source as well, if the patterns
used VSrc instead of VReg, but otherwise MUL would result in more
compact code.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer




More information about the llvm-commits mailing list