================
@@ -0,0 +1,44 @@
+# RUN: llvm-mc -filetype=obj -triple riscv32 < %s --defsym RV32=1  | 
llvm-objdump -d -M no-aliases - | FileCheck %s --check-prefixes=INST,RV32
+# RUN: llvm-mc -filetype=obj -triple riscv64 < %s | llvm-objdump -d -M 
no-aliases - | FileCheck %s --check-prefixes=INST,RV64
+
+# RUN: not llvm-mc -triple riscv32 < %s --defsym RV32=1 --defsym ERR=1 2>&1 | 
FileCheck %s --check-prefixes=ERR
+# RUN: not llvm-mc -triple riscv64 < %s --defsym ERR=1 2>&1 | FileCheck %s 
--check-prefixes=ERR
+
+start:                                  # @start
+# %bb.0:                                # %entry
+.Ltlsdesc_hi0:
+       auipc a0, %tlsdesc_hi(a-4)
+       # INST: auipc a0, 0x0
+       auipc   a0, %tlsdesc_hi(unspecified)
+       # INST: auipc a0, 0x0
+.ifdef RV32
+       lw      a1, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a0)
+       # RV32: lw a1, 0x0(a0)
+.else
+       ld      a1, %tlsdesc_load_lo(.Ltlsdesc_hi0)(a0)
+       #RV64: ld a1, 0x0(a0)
+.endif
+       addi    a0, a0, %tlsdesc_add_lo(.Ltlsdesc_hi0)
+       # INST: addi a0, a0, 0x0
+       jalr    t0, 0(a1), %tlsdesc_call(.Ltlsdesc_hi0)
+       # INST: jalr t0, 0x0(a1)
+       add     a0, a0, tp
+       # INST: add a0, a0, tp
+       ret
+
+## Check invalid usage
+.ifdef ERR
+       auipc x1, %tlsdesc_call(foo) # ERR: :[[@LINE]]:12: error: operand must 
be a symbol with a 
%pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi/%tlsdesc_hi modifier 
or an integer in the range
----------------
ilovepi wrote:

Thanks. done.

https://github.com/llvm/llvm-project/pull/66915
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to