[Mesa-dev] [PATCH 1/1] R600: Allow ftrunc
Tom Stellard
tom at stellard.net
Thu Dec 19 21:16:24 PST 2013
On Wed, Dec 18, 2013 at 04:50:53PM -0500, Jan Vesely wrote:
> v2: Add ftrunc->TRUNC pattern instead of replacing int_AMDGPU_trunc
> v3: move ftrunc pattern next to TRUNC definition, it's available since R600
>
I've pushed this patch, thanks!
I forgot to remind you to add a test case, so I added one for you. You
can use it as an example for your next patch.
-Tom
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> lib/Target/R600/AMDGPUISelLowering.cpp | 2 ++
> lib/Target/R600/R600Instructions.td | 3 +++
> 2 files changed, 5 insertions(+)
>
> diff --git a/lib/Target/R600/AMDGPUISelLowering.cpp b/lib/Target/R600/AMDGPUISelLowering.cpp
> index d7ee8e6..c59be7c 100644
> --- a/lib/Target/R600/AMDGPUISelLowering.cpp
> +++ b/lib/Target/R600/AMDGPUISelLowering.cpp
> @@ -60,6 +60,7 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(TargetMachine &TM) :
> setOperationAction(ISD::FFLOOR, MVT::f32, Legal);
> setOperationAction(ISD::FRINT, MVT::f32, Legal);
> setOperationAction(ISD::FROUND, MVT::f32, Legal);
> + setOperationAction(ISD::FTRUNC, MVT::f32, Legal);
>
> // The hardware supports ROTR, but not ROTL
> setOperationAction(ISD::ROTL, MVT::i32, Expand);
> @@ -184,6 +185,7 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(TargetMachine &TM) :
> setOperationAction(ISD::FADD, VT, Expand);
> setOperationAction(ISD::FDIV, VT, Expand);
> setOperationAction(ISD::FFLOOR, VT, Expand);
> + setOperationAction(ISD::FTRUNC, VT, Expand);
> setOperationAction(ISD::FMUL, VT, Expand);
> setOperationAction(ISD::FRINT, VT, Expand);
> setOperationAction(ISD::FSQRT, VT, Expand);
> diff --git a/lib/Target/R600/R600Instructions.td b/lib/Target/R600/R600Instructions.td
> index 2249cee..bad7f7c 100644
> --- a/lib/Target/R600/R600Instructions.td
> +++ b/lib/Target/R600/R600Instructions.td
> @@ -733,6 +733,9 @@ def CEIL : R600_1OP_Helper <0x12, "CEIL", fceil>;
> def RNDNE : R600_1OP_Helper <0x13, "RNDNE", frint>;
> def FLOOR : R600_1OP_Helper <0x14, "FLOOR", ffloor>;
>
> +// Add also ftrunc intrinsic pattern
> +def : Pat<(ftrunc f32:$src0), (TRUNC $src0)>;
> +
> def MOV : R600_1OP <0x19, "MOV", []>;
>
> let isPseudo = 1, isCodeGenOnly = 1, usesCustomInserter = 1 in {
> --
> 1.8.3.1
>
More information about the mesa-dev
mailing list