[PATCH] D136436: [Clang][LoongArch] Add register alias handling without `$` prefix

Youling Tang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 02:57:22 PDT 2022


tangyouling added a comment.

  $ cat prefix_regalias.c 
  int main()
  {
  	register unsigned long a0 asm("a0");
  	register unsigned long a1 asm("$a1");
  	register unsigned long a2 asm("r6");
  	register unsigned long a3 asm("$r7");
  	register float f0 asm("fa0");
  	register float f1 asm("$fa1");
  	register float f2 asm("f2");
  	register float f3 asm("$f3");
  
  	return 0;
  }
  
  clang before applying patch:
  $ clang prefix_regalias.c 
  prefix_regalias.c:3:32: error: unknown register name 'a0' in asm
          register unsigned long a0 asm("a0");
                                        ^
  prefix_regalias.c:5:32: error: unknown register name 'r6' in asm
          register unsigned long a2 asm("r6");
                                        ^
  prefix_regalias.c:7:24: error: unknown register name 'fa0' in asm
          register float f0 asm("fa0");
                                ^
  prefix_regalias.c:9:24: error: unknown register name 'f2' in asm
          register float f2 asm("f2");
                                ^
  4 errors generated.
  
  
  clang after applying patch:
  $ clang prefix_regalias.c 
  
  gcc:
  $ gcc prefix_regalias.c 
  prefix_regalias.c: In function ‘main’:
  prefix_regalias.c:7:24: error: invalid register name for ‘f0’
      7 |         register float f0 asm("fa0");
        |                        ^~
  prefix_regalias.c:8:24: error: invalid register name for ‘f1’
      8 |         register float f1 asm("$fa1");
        |          


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136436/new/

https://reviews.llvm.org/D136436



More information about the cfe-commits mailing list