1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d --verify-machineinstrs --no-integrated-as < %s \
4 ; RUN: llc --mtriple=loongarch64 -mattr=+d --verify-machineinstrs --no-integrated-as < %s \
7 @gi = external dso_local global i32, align 4
9 define i32 @constraint_r(i32 %a, i32 %b) nounwind {
10 ; CHECK-LABEL: constraint_r:
13 ; CHECK-NEXT: add.w $a0, $a0, $a1
16 %1 = tail call i32 asm "add.w $0, $1, $2", "=r,r,r"(i32 %a, i32 %b)
20 define i32 @constraint_i(i32 %a) nounwind {
21 ; CHECK-LABEL: constraint_i:
24 ; CHECK-NEXT: addi.w $a0, $a0, 113
27 %1 = tail call i32 asm "addi.w $0, $1, $2", "=r,r,i"(i32 %a, i32 113)
31 define void @constraint_l() nounwind {
32 ; CHECK-LABEL: constraint_l:
35 ; CHECK-NEXT: lu12i.w $a0, 32767
38 ; CHECK-NEXT: lu12i.w $a0, -32768
41 tail call void asm sideeffect "lu12i.w $$a0, $0", "l"(i32 32767)
42 tail call void asm sideeffect "lu12i.w $$a0, $0", "l"(i32 -32768)
46 define void @constraint_I() nounwind {
47 ; CHECK-LABEL: constraint_I:
50 ; CHECK-NEXT: addi.w $a0, $a0, 2047
53 ; CHECK-NEXT: addi.w $a0, $a0, -2048
56 tail call void asm sideeffect "addi.w $$a0, $$a0, $0", "I"(i32 2047)
57 tail call void asm sideeffect "addi.w $$a0, $$a0, $0", "I"(i32 -2048)
61 define void @constraint_J() nounwind {
62 ; CHECK-LABEL: constraint_J:
65 ; CHECK-NEXT: addi.w $a0, $a0, 0
68 tail call void asm sideeffect "addi.w $$a0, $$a0, $0", "J"(i32 0)
72 define void @constraint_K() nounwind {
73 ; CHECK-LABEL: constraint_K:
76 ; CHECK-NEXT: andi $a0, $a0, 4095
79 ; CHECK-NEXT: andi $a0, $a0, 0
82 tail call void asm sideeffect "andi $$a0, $$a0, $0", "K"(i32 4095)
83 tail call void asm sideeffect "andi $$a0, $$a0, $0", "K"(i32 0)
87 define void @operand_global() nounwind {
88 ; CHECK-LABEL: operand_global:
91 ; CHECK-NEXT: .8byte gi
94 tail call void asm sideeffect ".8byte $0", "i"(ptr @gi)
98 define void @operand_block_address() nounwind {
99 ; CHECK-LABEL: operand_block_address:
102 ; CHECK-NEXT: b .Ltmp0
103 ; CHECK-NEXT: #NO_APP
104 ; CHECK-NEXT: .Ltmp0: # Block address taken
105 ; CHECK-NEXT: # %bb.1: # %bb
107 call void asm sideeffect "b $0", "i"(ptr blockaddress(@operand_block_address, %bb))