[Mesa-dev] [PATCH 2/4] AMDGPU: Print integer and floating point values for literals

Vincent Lejeune vljn at ovi.com
Tue Nov 13 07:51:15 PST 2012


Reviewed-by: Vincent Lejeune <vljn at ovi.com>


----- Mail original -----
> De : Tom Stellard <tom at stellard.net>
> À : mesa-dev at lists.freedesktop.org
> Cc : Tom Stellard <thomas.stellard at amd.com>
> Envoyé le : Vendredi 9 novembre 2012 21h47
> Objet : [Mesa-dev] [PATCH 2/4] AMDGPU: Print integer and floating point values for literals
> 
> From: Tom Stellard <thomas.stellard at amd.com>
> 
> ---
> lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp | 11 +++++++++++
> lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h   |  1 +
> lib/Target/AMDGPU/R600Instructions.td               |  2 +-
> 3 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp 
> b/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp
> index fe2032e..7ed3d2c 100644
> --- a/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp
> +++ b/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp
> @@ -63,6 +63,17 @@ void AMDGPUInstPrinter::printClamp(const MCInst *MI, unsigned 
> OpNo,
>    printIfSet(MI, OpNo, O, "_SAT");
> }
> 
> +void AMDGPUInstPrinter::printLiteral(const MCInst *MI, unsigned OpNo,
> +                                     raw_ostream &O) {
> +  union Literal {
> +    float f;
> +    int32_t i;
> +  } L;
> +
> +  L.i = MI->getOperand(OpNo).getImm();
> +  O << L.i << "(" << L.f << ")";
> +}
> +
> void AMDGPUInstPrinter::printLast(const MCInst *MI, unsigned OpNo,
>                                    raw_ostream &O) {
>    printIfSet(MI, OpNo, O, " *");
> diff --git a/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h 
> b/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h
> index de94eda..1f70ef5 100644
> --- a/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h
> +++ b/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h
> @@ -36,6 +36,7 @@ private:
>    void printIfSet(const MCInst *MI, unsigned OpNo, raw_ostream &O, 
> StringRef Asm);
>    void printAbs(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>    void printClamp(const MCInst *MI, unsigned OpNo, raw_ostream &O);
> +  void printLiteral(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>    void printLast(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>    void printNeg(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>    void printOMOD(const MCInst *MI, unsigned OpNo, raw_ostream &O);
> diff --git a/lib/Target/AMDGPU/R600Instructions.td 
> b/lib/Target/AMDGPU/R600Instructions.td
> index c8cf012..ccec249 100644
> --- a/lib/Target/AMDGPU/R600Instructions.td
> +++ b/lib/Target/AMDGPU/R600Instructions.td
> @@ -70,7 +70,7 @@ class InstFlag<string PM = "printOperand", int 
> Default = 0>
>    let PrintMethod = PM;
> }
> 
> -def LITERAL : InstFlag;
> +def LITERAL : InstFlag<"printLiteral">;
> 
> def WRITE : InstFlag <"printWrite", 1>;
> def OMOD : InstFlag <"printOMOD">;
> -- 
> 1.7.11.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list