Skip to content

Commit fa8347f

Browse files
[Clang][RISCV] bfloat uses 'y' instead of 'b' (#76575)
Builtins.def says that bfloat should be represented by the 'y' character, not the 'b' character. The 'b' character is specified to represent boolean. The implementation currently uses 'b' correctly for boolean and incorrectly re-uses 'b' for bfloat. This was not caught since no builtins are emitted in build/tools/clang/include/clang/Basic/riscv_sifive_vector_builtins.inc. Don't know that we can test this without creating builtins that expose this issue, although I'm not sure we really want to do that.
1 parent 81cedac commit fa8347f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

clang/include/clang/Basic/riscv_sifive_vector.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ multiclass RVVVFWMACCBuiltinSet<list<list<string>> suffixes_prototypes> {
109109
Name = NAME,
110110
HasMasked = false,
111111
Log2LMUL = [-2, -1, 0, 1, 2] in
112-
defm NAME : RVVOutOp1Op2BuiltinSet<NAME, "b", suffixes_prototypes>;
112+
defm NAME : RVVOutOp1Op2BuiltinSet<NAME, "y", suffixes_prototypes>;
113113
}
114114

115115
multiclass RVVVQMACCDODBuiltinSet<list<list<string>> suffixes_prototypes> {

clang/include/clang/Basic/riscv_vector_common.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// x: float16_t (half)
4242
// f: float32_t (float)
4343
// d: float64_t (double)
44-
// b: bfloat16_t (bfloat16)
44+
// y: bfloat16_t (bfloat16)
4545
//
4646
// This way, given an LMUL, a record with a TypeRange "sil" will cause the
4747
// definition of 3 builtins. Each type "t" in the TypeRange (in this example

clang/lib/Support/RISCVVIntrinsicUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void RVVType::initBuiltinStr() {
203203
}
204204
break;
205205
case ScalarTypeKind::BFloat:
206-
BuiltinStr += "b";
206+
BuiltinStr += "y";
207207
break;
208208
default:
209209
llvm_unreachable("ScalarType is invalid!");

clang/utils/TableGen/RISCVVEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static BasicType ParseBasicType(char c) {
151151
case 'd':
152152
return BasicType::Float64;
153153
break;
154-
case 'b':
154+
case 'y':
155155
return BasicType::BFloat16;
156156
break;
157157
default:

0 commit comments

Comments
 (0)