Skip to content

Commit b405e32

Browse files
authored
[RISCV] Add MVendorID, MArchID, and MImpID for sifive-p550. (#159465)
1 parent d62505f commit b405e32

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

clang/test/CodeGen/RISCV/builtin-cpu-is.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,21 @@ int test_cpu_is_veyron_v1() {
3737
int test_cpu_is_spacemit_x60() {
3838
return __builtin_cpu_is("spacemit-x60");
3939
}
40+
41+
// CHECK-RV64-LABEL: define dso_local signext i32 @test_cpu_is_sifive_p550(
42+
// CHECK-RV64-SAME: ) #[[ATTR0]] {
43+
// CHECK-RV64-NEXT: [[ENTRY:.*:]]
44+
// CHECK-RV64-NEXT: [[TMP0:%.*]] = load i32, ptr @__riscv_cpu_model, align 4
45+
// CHECK-RV64-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 1161
46+
// CHECK-RV64-NEXT: [[TMP2:%.*]] = load i64, ptr getelementptr inbounds nuw ({ i32, i64, i64 }, ptr @__riscv_cpu_model, i32 0, i32 1), align 8
47+
// CHECK-RV64-NEXT: [[TMP3:%.*]] = icmp eq i64 [[TMP2]], -9223372036854775800
48+
// CHECK-RV64-NEXT: [[TMP4:%.*]] = and i1 [[TMP1]], [[TMP3]]
49+
// CHECK-RV64-NEXT: [[TMP5:%.*]] = load i64, ptr getelementptr inbounds nuw ({ i32, i64, i64 }, ptr @__riscv_cpu_model, i32 0, i32 2), align 8
50+
// CHECK-RV64-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 102892581
51+
// CHECK-RV64-NEXT: [[TMP7:%.*]] = and i1 [[TMP4]], [[TMP6]]
52+
// CHECK-RV64-NEXT: [[CONV:%.*]] = zext i1 [[TMP7]] to i32
53+
// CHECK-RV64-NEXT: ret i32 [[CONV]]
54+
//
55+
int test_cpu_is_sifive_p550() {
56+
return __builtin_cpu_is("sifive-p550");
57+
}

llvm/lib/Target/RISCV/RISCVProcessors.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,11 @@ def SIFIVE_P550 : RISCVProcessorModel<"sifive-p550", SiFiveP500Model,
390390
FeatureStdExtC,
391391
FeatureStdExtZba,
392392
FeatureStdExtZbb],
393-
SiFiveP500TuneFeatures>;
393+
SiFiveP500TuneFeatures> {
394+
let MVendorID = 0x489;
395+
let MArchID = 0x8000000000000008;
396+
let MImpID = 0x6220425;
397+
}
394398

395399
def SIFIVE_P670 : RISCVProcessorModel<"sifive-p670", SiFiveP600Model,
396400
!listconcat(RVA22U64Features,

0 commit comments

Comments
 (0)