[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
https://github.com/4vtomat closed https://github.com/llvm/llvm-project/pull/83553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
https://github.com/topperc approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/83553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
https://github.com/topperc approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/83553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
4vtomat wrote: Maybe we can modify the current test case, it would get the error message "RISC-V type 'vfloat64m1_t' ... requires the 'zve64x' extension", but should be 'zve64d' instead. https://github.com/llvm/llvm-project/pull/83553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
https://github.com/4vtomat updated https://github.com/llvm/llvm-project/pull/83553 >From 8ad3a883d29155dc26c79abdd57ea0f72d046dfc Mon Sep 17 00:00:00 2001 From: Brandon Wu Date: Fri, 1 Mar 2024 00:40:21 -0800 Subject: [PATCH 1/3] [clang][RISCV] Reorder sema check for RVV type Currently using the command `clang -cc1 -triple riscv64` to compile the code below: ``` #include void foo() { vfloat64m1_t f64m1; } ``` would get the error message "RISC-V type 'vfloat64m1_t' ... requires the 'zve64x' extension" which is supposed to be "RISC-V type 'vfloat64m1_t' ... requires the 'zve64d' extension". --- clang/lib/Sema/SemaChecking.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 979b63884359fc..27ed6f2da05254 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6332,9 +6332,12 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { unsigned EltSize = Context.getTypeSize(Info.ElementType); unsigned MinElts = Info.EC.getKnownMinValue(); + if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && + !TI.hasFeature("zve64d")) +Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at // least zve64x - if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && + else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && !TI.hasFeature("zve64x")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x"; else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") && @@ -6347,9 +6350,6 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Float) && !TI.hasFeature("zve32f")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve32f"; - else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && - !TI.hasFeature("zve64d")) -Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // Given that caller already checked isRVVType() before calling this function, // if we don't have at least zve32x supported, then we need to emit error. else if (!TI.hasFeature("zve32x")) >From 779aebac10d2128d4507f74c2c929ab0924a80b6 Mon Sep 17 00:00:00 2001 From: Brandon Wu Date: Fri, 1 Mar 2024 02:57:00 -0800 Subject: [PATCH 2/3] fixup! [clang][RISCV] Reorder sema check for RVV type --- clang/lib/Sema/SemaChecking.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 27ed6f2da05254..ae011806eec629 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6333,12 +6333,13 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { unsigned MinElts = Info.EC.getKnownMinValue(); if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && - !TI.hasFeature("zve64d")) + !TI.hasFeature("zve64d")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at // least zve64x - else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && - !TI.hasFeature("zve64x")) + else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || +MinElts == 1) && + !TI.hasFeature("zve64x")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x"; else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") && !TI.hasFeature("zvfhmin")) >From ee33c7d12c307835b5f999eef9f3db6f0d0071f7 Mon Sep 17 00:00:00 2001 From: Brandon Wu Date: Sat, 2 Mar 2024 02:58:12 -0800 Subject: [PATCH 3/3] fixup! [clang][RISCV] Reorder sema check for RVV type --- clang/test/Sema/riscv-vector-float64-check.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/test/Sema/riscv-vector-float64-check.c b/clang/test/Sema/riscv-vector-float64-check.c index ee7db32663959e..f21ae5c0c70405 100644 --- a/clang/test/Sema/riscv-vector-float64-check.c +++ b/clang/test/Sema/riscv-vector-float64-check.c @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -triple riscv64 -target-feature +f -target-feature +d \ -// RUN: -target-feature +zve64f -target-feature +zfh \ +// RUN: %clang_cc1 -triple riscv64 -target-feature +zve32x \ // RUN: -disable-O0-optnone -o - -fsyntax-only %s -verify // REQUIRES: riscv-registered-target #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
https://github.com/kito-cheng commented: Could you add a testcase? https://github.com/llvm/llvm-project/pull/83553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
https://github.com/4vtomat updated https://github.com/llvm/llvm-project/pull/83553 >From 8ad3a883d29155dc26c79abdd57ea0f72d046dfc Mon Sep 17 00:00:00 2001 From: Brandon Wu Date: Fri, 1 Mar 2024 00:40:21 -0800 Subject: [PATCH 1/2] [clang][RISCV] Reorder sema check for RVV type Currently using the command `clang -cc1 -triple riscv64` to compile the code below: ``` #include void foo() { vfloat64m1_t f64m1; } ``` would get the error message "RISC-V type 'vfloat64m1_t' ... requires the 'zve64x' extension" which is supposed to be "RISC-V type 'vfloat64m1_t' ... requires the 'zve64d' extension". --- clang/lib/Sema/SemaChecking.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 979b63884359fc..27ed6f2da05254 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6332,9 +6332,12 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { unsigned EltSize = Context.getTypeSize(Info.ElementType); unsigned MinElts = Info.EC.getKnownMinValue(); + if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && + !TI.hasFeature("zve64d")) +Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at // least zve64x - if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && + else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && !TI.hasFeature("zve64x")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x"; else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") && @@ -6347,9 +6350,6 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Float) && !TI.hasFeature("zve32f")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve32f"; - else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && - !TI.hasFeature("zve64d")) -Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // Given that caller already checked isRVVType() before calling this function, // if we don't have at least zve32x supported, then we need to emit error. else if (!TI.hasFeature("zve32x")) >From 779aebac10d2128d4507f74c2c929ab0924a80b6 Mon Sep 17 00:00:00 2001 From: Brandon Wu Date: Fri, 1 Mar 2024 02:57:00 -0800 Subject: [PATCH 2/2] fixup! [clang][RISCV] Reorder sema check for RVV type --- clang/lib/Sema/SemaChecking.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 27ed6f2da05254..ae011806eec629 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6333,12 +6333,13 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { unsigned MinElts = Info.EC.getKnownMinValue(); if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && - !TI.hasFeature("zve64d")) + !TI.hasFeature("zve64d")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at // least zve64x - else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && - !TI.hasFeature("zve64x")) + else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || +MinElts == 1) && + !TI.hasFeature("zve64x")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x"; else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") && !TI.hasFeature("zvfhmin")) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 14d8c4563e045fc3da82cb7268b1066cfd1bb6f0 8ad3a883d29155dc26c79abdd57ea0f72d046dfc -- clang/lib/Sema/SemaChecking.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 27ed6f2da0..ae011806ee 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6333,12 +6333,13 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { unsigned MinElts = Info.EC.getKnownMinValue(); if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && - !TI.hasFeature("zve64d")) + !TI.hasFeature("zve64d")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at // least zve64x - else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && - !TI.hasFeature("zve64x")) + else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || +MinElts == 1) && + !TI.hasFeature("zve64x")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x"; else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") && !TI.hasFeature("zvfhmin")) `` https://github.com/llvm/llvm-project/pull/83553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Brandon Wu (4vtomat) Changes Currently using the command `clang -cc1 -triple riscv64` to compile the code below: ``` #includevoid foo() { vfloat64m1_t f64m1; } ``` would get the error message "RISC-V type 'vfloat64m1_t' ... requires the 'zve64x' extension" which is supposed to be "RISC-V type 'vfloat64m1_t' ... requires the 'zve64d' extension". --- Full diff: https://github.com/llvm/llvm-project/pull/83553.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaChecking.cpp (+4-4) ``diff diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 979b63884359fc..27ed6f2da05254 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6332,9 +6332,12 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { unsigned EltSize = Context.getTypeSize(Info.ElementType); unsigned MinElts = Info.EC.getKnownMinValue(); + if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && + !TI.hasFeature("zve64d")) +Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at // least zve64x - if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && + else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && !TI.hasFeature("zve64x")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x"; else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") && @@ -6347,9 +6350,6 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Float) && !TI.hasFeature("zve32f")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve32f"; - else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && - !TI.hasFeature("zve64d")) -Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // Given that caller already checked isRVVType() before calling this function, // if we don't have at least zve32x supported, then we need to emit error. else if (!TI.hasFeature("zve32x")) `` https://github.com/llvm/llvm-project/pull/83553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][RISCV] Reorder sema check for RVV type (PR #83553)
https://github.com/4vtomat created https://github.com/llvm/llvm-project/pull/83553 Currently using the command `clang -cc1 -triple riscv64` to compile the code below: ``` #include void foo() { vfloat64m1_t f64m1; } ``` would get the error message "RISC-V type 'vfloat64m1_t' ... requires the 'zve64x' extension" which is supposed to be "RISC-V type 'vfloat64m1_t' ... requires the 'zve64d' extension". >From 8ad3a883d29155dc26c79abdd57ea0f72d046dfc Mon Sep 17 00:00:00 2001 From: Brandon Wu Date: Fri, 1 Mar 2024 00:40:21 -0800 Subject: [PATCH] [clang][RISCV] Reorder sema check for RVV type Currently using the command `clang -cc1 -triple riscv64` to compile the code below: ``` #include void foo() { vfloat64m1_t f64m1; } ``` would get the error message "RISC-V type 'vfloat64m1_t' ... requires the 'zve64x' extension" which is supposed to be "RISC-V type 'vfloat64m1_t' ... requires the 'zve64d' extension". --- clang/lib/Sema/SemaChecking.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 979b63884359fc..27ed6f2da05254 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6332,9 +6332,12 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { unsigned EltSize = Context.getTypeSize(Info.ElementType); unsigned MinElts = Info.EC.getKnownMinValue(); + if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && + !TI.hasFeature("zve64d")) +Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at // least zve64x - if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && + else if (((EltSize == 64 && Info.ElementType->isIntegerType()) || MinElts == 1) && !TI.hasFeature("zve64x")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64x"; else if (Info.ElementType->isFloat16Type() && !TI.hasFeature("zvfh") && @@ -6347,9 +6350,6 @@ void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) { else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Float) && !TI.hasFeature("zve32f")) Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve32f"; - else if (Info.ElementType->isSpecificBuiltinType(BuiltinType::Double) && - !TI.hasFeature("zve64d")) -Diag(Loc, diag::err_riscv_type_requires_extension, D) << Ty << "zve64d"; // Given that caller already checked isRVVType() before calling this function, // if we don't have at least zve32x supported, then we need to emit error. else if (!TI.hasFeature("zve32x")) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits