[PATCH] R600/SI: Fix emitting trailing whitespace after s_waitcnt

Tom Stellard tom at stellard.net
Thu Sep 25 18:01:27 PDT 2014


On Fri, Sep 26, 2014 at 12:00:37AM +0000, Matt Arsenault wrote:
> http://reviews.llvm.org/D5497

LGTM.
> 
> Files:
>   lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
>   test/CodeGen/R600/wait.ll

> Index: lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
> ===================================================================
> --- lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
> +++ lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
> @@ -493,12 +493,26 @@
>    unsigned Vmcnt = SImm16 & 0xF;
>    unsigned Expcnt = (SImm16 >> 4) & 0xF;
>    unsigned Lgkmcnt = (SImm16 >> 8) & 0xF;
> -  if (Vmcnt != 0xF)
> -    O << "vmcnt(" << Vmcnt << ") ";
> -  if (Expcnt != 0x7)
> -    O << "expcnt(" << Expcnt << ") ";
> -  if (Lgkmcnt != 0x7)
> +
> +  bool NeedSpace = false;
> +
> +  if (Vmcnt != 0xF) {
> +    O << "vmcnt(" << Vmcnt << ')';
> +    NeedSpace = true;
> +  }
> +
> +  if (Expcnt != 0x7) {
> +    if (NeedSpace)
> +      O << ' ';
> +    O << "expcnt(" << Expcnt << ')';
> +    NeedSpace = true;
> +  }
> +
> +  if (Lgkmcnt != 0x7) {
> +    if (NeedSpace)
> +      O << ' ';
>      O << "lgkmcnt(" << Lgkmcnt << ')';
> +  }
>  }
>  
>  #include "AMDGPUGenAsmWriter.inc"
> Index: test/CodeGen/R600/wait.ll
> ===================================================================
> --- test/CodeGen/R600/wait.ll
> +++ test/CodeGen/R600/wait.ll
> @@ -1,11 +1,11 @@
> -; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck %s
> +; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -strict-whitespace %s
>  
>  ; CHECK-LABEL: @main
>  ; CHECK: S_LOAD_DWORDX4
>  ; CHECK: S_LOAD_DWORDX4
> -; CHECK: S_WAITCNT lgkmcnt(0)
> -; CHECK: S_WAITCNT vmcnt(0)
> -; CHECK: S_WAITCNT expcnt(0) lgkmcnt(0)
> +; CHECK: S_WAITCNT lgkmcnt(0){{$}}
> +; CHECK: S_WAITCNT vmcnt(0){{$}}
> +; CHECK: S_WAITCNT expcnt(0) lgkmcnt(0){{$}}
>  define void @main(<16 x i8> addrspace(2)* inreg %arg, <16 x i8> addrspace(2)* inreg %arg1, <32 x i8> addrspace(2)* inreg %arg2, <16 x i8> addrspace(2)* inreg %arg3, <16 x i8> addrspace(2)* inreg %arg4, i32 inreg %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9, float addrspace(2)* inreg %constptr) #0 {
>  main_body:
>    %tmp = getelementptr <16 x i8> addrspace(2)* %arg3, i32 0

> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list