Skip to content

Commit 10055fb

Browse files
authored
Rollup merge of rust-lang#138056 - heiher:loong64v1.1-features, r=petrochenkov
rustc_target: Add target features for LoongArch v1.1 This patch adds new target features for LoongArch v1.1: * div32 * lam-bh * lamcas * ld-seq-sa * scq
2 parents ecade53 + d989bf5 commit 10055fb

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

compiler/rustc_target/src/target_features.rs

+5
Original file line numberDiff line numberDiff line change
@@ -603,13 +603,18 @@ static CSKY_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
603603
static LOONGARCH_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
604604
// tidy-alphabetical-start
605605
("d", Unstable(sym::loongarch_target_feature), &["f"]),
606+
("div32", Unstable(sym::loongarch_target_feature), &[]),
606607
("f", Unstable(sym::loongarch_target_feature), &[]),
607608
("frecipe", Unstable(sym::loongarch_target_feature), &[]),
609+
("lam-bh", Unstable(sym::loongarch_target_feature), &[]),
610+
("lamcas", Unstable(sym::loongarch_target_feature), &[]),
608611
("lasx", Unstable(sym::loongarch_target_feature), &["lsx"]),
609612
("lbt", Unstable(sym::loongarch_target_feature), &[]),
613+
("ld-seq-sa", Unstable(sym::loongarch_target_feature), &[]),
610614
("lsx", Unstable(sym::loongarch_target_feature), &["d"]),
611615
("lvz", Unstable(sym::loongarch_target_feature), &[]),
612616
("relax", Unstable(sym::loongarch_target_feature), &[]),
617+
("scq", Unstable(sym::loongarch_target_feature), &[]),
613618
("ual", Unstable(sym::loongarch_target_feature), &[]),
614619
// tidy-alphabetical-end
615620
];

tests/ui/abi/compatibility.rs

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
//@ revisions: loongarch64
4141
//@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
4242
//@[loongarch64] needs-llvm-components: loongarch
43+
//@[loongarch64] min-llvm-version: 20
4344
//FIXME: wasm is disabled due to <https://github.com/rust-lang/rust/issues/115666>.
4445
//FIXME @ revisions: wasm
4546
//FIXME @[wasm] compile-flags: --target wasm32-unknown-unknown

tests/ui/asm/loongarch/bad-reg.loongarch64_lp64d.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm
2-
--> $DIR/bad-reg.rs:22:18
2+
--> $DIR/bad-reg.rs:23:18
33
|
44
LL | asm!("", out("$r0") _);
55
| ^^^^^^^^^^^^
66

77
error: invalid register `$tp`: reserved for TLS
8-
--> $DIR/bad-reg.rs:24:18
8+
--> $DIR/bad-reg.rs:25:18
99
|
1010
LL | asm!("", out("$tp") _);
1111
| ^^^^^^^^^^^^
1212

1313
error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm
14-
--> $DIR/bad-reg.rs:26:18
14+
--> $DIR/bad-reg.rs:27:18
1515
|
1616
LL | asm!("", out("$sp") _);
1717
| ^^^^^^^^^^^^
1818

1919
error: invalid register `$r21`: reserved by the ABI
20-
--> $DIR/bad-reg.rs:28:18
20+
--> $DIR/bad-reg.rs:29:18
2121
|
2222
LL | asm!("", out("$r21") _);
2323
| ^^^^^^^^^^^^^
2424

2525
error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm
26-
--> $DIR/bad-reg.rs:30:18
26+
--> $DIR/bad-reg.rs:31:18
2727
|
2828
LL | asm!("", out("$fp") _);
2929
| ^^^^^^^^^^^^
3030

3131
error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm
32-
--> $DIR/bad-reg.rs:32:18
32+
--> $DIR/bad-reg.rs:33:18
3333
|
3434
LL | asm!("", out("$r31") _);
3535
| ^^^^^^^^^^^^^

tests/ui/asm/loongarch/bad-reg.loongarch64_lp64s.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
error: invalid register `$r0`: constant zero cannot be used as an operand for inline asm
2-
--> $DIR/bad-reg.rs:22:18
2+
--> $DIR/bad-reg.rs:23:18
33
|
44
LL | asm!("", out("$r0") _);
55
| ^^^^^^^^^^^^
66

77
error: invalid register `$tp`: reserved for TLS
8-
--> $DIR/bad-reg.rs:24:18
8+
--> $DIR/bad-reg.rs:25:18
99
|
1010
LL | asm!("", out("$tp") _);
1111
| ^^^^^^^^^^^^
1212

1313
error: invalid register `$sp`: the stack pointer cannot be used as an operand for inline asm
14-
--> $DIR/bad-reg.rs:26:18
14+
--> $DIR/bad-reg.rs:27:18
1515
|
1616
LL | asm!("", out("$sp") _);
1717
| ^^^^^^^^^^^^
1818

1919
error: invalid register `$r21`: reserved by the ABI
20-
--> $DIR/bad-reg.rs:28:18
20+
--> $DIR/bad-reg.rs:29:18
2121
|
2222
LL | asm!("", out("$r21") _);
2323
| ^^^^^^^^^^^^^
2424

2525
error: invalid register `$fp`: the frame pointer cannot be used as an operand for inline asm
26-
--> $DIR/bad-reg.rs:30:18
26+
--> $DIR/bad-reg.rs:31:18
2727
|
2828
LL | asm!("", out("$fp") _);
2929
| ^^^^^^^^^^^^
3030

3131
error: invalid register `$r31`: $r31 is used internally by LLVM and cannot be used as an operand for inline asm
32-
--> $DIR/bad-reg.rs:32:18
32+
--> $DIR/bad-reg.rs:33:18
3333
|
3434
LL | asm!("", out("$r31") _);
3535
| ^^^^^^^^^^^^^
3636

3737
error: register class `freg` requires at least one of the following target features: d, f
38-
--> $DIR/bad-reg.rs:36:26
38+
--> $DIR/bad-reg.rs:37:26
3939
|
4040
LL | asm!("/* {} */", in(freg) f);
4141
| ^^^^^^^^^^
4242

4343
error: register class `freg` requires at least one of the following target features: d, f
44-
--> $DIR/bad-reg.rs:38:26
44+
--> $DIR/bad-reg.rs:39:26
4545
|
4646
LL | asm!("/* {} */", out(freg) _);
4747
| ^^^^^^^^^^^
4848

4949
error: register class `freg` requires at least one of the following target features: d, f
50-
--> $DIR/bad-reg.rs:40:26
50+
--> $DIR/bad-reg.rs:41:26
5151
|
5252
LL | asm!("/* {} */", in(freg) d);
5353
| ^^^^^^^^^^
5454

5555
error: register class `freg` requires at least one of the following target features: d, f
56-
--> $DIR/bad-reg.rs:42:26
56+
--> $DIR/bad-reg.rs:43:26
5757
|
5858
LL | asm!("/* {} */", out(freg) d);
5959
| ^^^^^^^^^^^

tests/ui/asm/loongarch/bad-reg.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ add-core-stubs
22
//@ needs-asm-support
33
//@ revisions: loongarch64_lp64d loongarch64_lp64s
4+
//@ min-llvm-version: 20
45
//@[loongarch64_lp64d] compile-flags: --target loongarch64-unknown-linux-gnu
56
//@[loongarch64_lp64d] needs-llvm-components: loongarch
67
//@[loongarch64_lp64s] compile-flags: --target loongarch64-unknown-none-softfloat

tests/ui/check-cfg/target_feature.stderr

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
6060
`d32`
6161
`deflate-conversion`
6262
`dit`
63+
`div32`
6364
`doloop`
6465
`dotprod`
6566
`dpb`
@@ -133,8 +134,11 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
133134
`jsconv`
134135
`kl`
135136
`lahfsahf`
137+
`lam-bh`
138+
`lamcas`
136139
`lasx`
137140
`lbt`
141+
`ld-seq-sa`
138142
`leoncasa`
139143
`lor`
140144
`lse`
@@ -190,6 +194,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
190194
`reserve-x18`
191195
`rtm`
192196
`sb`
197+
`scq`
193198
`sha`
194199
`sha2`
195200
`sha3`

0 commit comments

Comments
 (0)