Skip to content

Commit ca2737d

Browse files
ziyao233bibo-mao
authored andcommitted
host/include/loongarch64: Fix inline assembly compatibility with Clang
Clang on LoongArch only accepts fp register names in the dollar-prefixed form, while GCC allows omitting the dollar. Change registers in ASM clobbers to the dollar-prefixed form to make user emulators buildable with Clang on loongarch64. No functional change invovled. Cc: [email protected] Fixes: adc8467 ("host/include/loongarch64: Add atomic16 load and store") Signed-off-by: Yao Zi <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Reviewed-by: Bibo Mao <[email protected]> Signed-off-by: Bibo Mao <[email protected]>
1 parent 1dae461 commit ca2737d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

host/include/loongarch64/host/atomic128-ldst.h.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static inline Int128 atomic16_read_ro(const Int128 *ptr)
2828
asm("vld $vr0, %2, 0\n\t"
2929
"vpickve2gr.d %0, $vr0, 0\n\t"
3030
"vpickve2gr.d %1, $vr0, 1"
31-
: "=r"(l), "=r"(h) : "r"(ptr), "m"(*ptr) : "f0");
31+
: "=r"(l), "=r"(h) : "r"(ptr), "m"(*ptr) : "$f0");
3232

3333
return int128_make128(l, h);
3434
}
@@ -46,7 +46,7 @@ static inline void atomic16_set(Int128 *ptr, Int128 val)
4646
asm("vinsgr2vr.d $vr0, %1, 0\n\t"
4747
"vinsgr2vr.d $vr0, %2, 1\n\t"
4848
"vst $vr0, %3, 0"
49-
: "=m"(*ptr) : "r"(l), "r"(h), "r"(ptr) : "f0");
49+
: "=m"(*ptr) : "r"(l), "r"(h), "r"(ptr) : "$f0");
5050
}
5151

5252
#endif /* LOONGARCH_ATOMIC128_LDST_H */

host/include/loongarch64/host/bufferiszero.c.inc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ static bool buffer_is_zero_lsx(const void *buf, size_t len)
6161
"2:"
6262
: "=&r"(ret), "+r"(p)
6363
: "r"(buf), "r"(e), "r"(l)
64-
: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "fcc0");
64+
: "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8",
65+
"$fcc0");
6566

6667
return ret;
6768
}
@@ -119,7 +120,8 @@ static bool buffer_is_zero_lasx(const void *buf, size_t len)
119120
"3:"
120121
: "=&r"(ret), "+r"(p)
121122
: "r"(buf), "r"(e), "r"(l)
122-
: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "fcc0");
123+
: "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8",
124+
"$fcc0");
123125

124126
return ret;
125127
}

host/include/loongarch64/host/load-extract-al16-al8.h.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static inline uint64_t load_atom_extract_al16_or_al8(void *pv, int s)
3131
asm("vld $vr0, %2, 0\n\t"
3232
"vpickve2gr.d %0, $vr0, 0\n\t"
3333
"vpickve2gr.d %1, $vr0, 1"
34-
: "=r"(l), "=r"(h) : "r"(ptr_align), "m"(*ptr_align) : "f0");
34+
: "=r"(l), "=r"(h) : "r"(ptr_align), "m"(*ptr_align) : "$f0");
3535

3636
return (l >> shr) | (h << (-shr & 63));
3737
}

0 commit comments

Comments
 (0)