@@ -149,7 +149,8 @@ class Type {
149149 SInt,
150150 UInt,
151151 Poly,
152- BFloat16
152+ BFloat16,
153+ MFloat8,
153154 };
154155 TypeKind Kind;
155156 bool Immediate, Constant, Pointer;
@@ -194,10 +195,11 @@ class Type {
194195 bool isPoly () const { return Kind == Poly; }
195196 bool isSigned () const { return Kind == SInt; }
196197 bool isImmediate () const { return Immediate; }
198+ bool isMFloat8 () const { return Kind == MFloat8; }
197199 bool isFloat () const { return isFloating () && ElementBitwidth == 32 ; }
198200 bool isDouble () const { return isFloating () && ElementBitwidth == 64 ; }
199201 bool isHalf () const { return isFloating () && ElementBitwidth == 16 ; }
200- bool isChar () const { return ElementBitwidth == 8 ; }
202+ bool isChar () const { return ElementBitwidth == 8 && ! isMFloat8 () ; }
201203 bool isShort () const { return isInteger () && ElementBitwidth == 16 ; }
202204 bool isInt () const { return isInteger () && ElementBitwidth == 32 ; }
203205 bool isLong () const { return isInteger () && ElementBitwidth == 64 ; }
@@ -657,6 +659,8 @@ std::string Type::str() const {
657659 S += " float" ;
658660 else if (isBFloat16 ())
659661 S += " bfloat" ;
662+ else if (isMFloat8 ())
663+ S += " mfloat" ;
660664 else
661665 S += " int" ;
662666
@@ -699,6 +703,9 @@ std::string Type::builtin_str() const {
699703 else if (isBFloat16 ()) {
700704 assert (ElementBitwidth == 16 && " BFloat16 can only be 16 bits" );
701705 S += " y" ;
706+ } else if (isMFloat8 ()) {
707+ assert (ElementBitwidth == 8 && " MFloat8 can only be 8 bits" );
708+ S += " c" ;
702709 } else
703710 switch (ElementBitwidth) {
704711 case 16 : S += " h" ; break ;
@@ -779,6 +786,8 @@ Type Type::fromTypedefName(StringRef Name) {
779786 T.Kind = Poly;
780787 } else if (Name.consume_front (" bfloat" )) {
781788 T.Kind = BFloat16;
789+ } else if (Name.consume_front (" mfp" )) {
790+ T.Kind = MFloat8;
782791 } else {
783792 assert (Name.starts_with (" int" ));
784793 Name = Name.drop_front (3 );
@@ -879,6 +888,10 @@ void Type::applyTypespec(bool &Quad) {
879888 Kind = BFloat16;
880889 ElementBitwidth = 16 ;
881890 break ;
891+ case ' m' :
892+ Kind = MFloat8;
893+ ElementBitwidth = 8 ;
894+ break ;
882895 default :
883896 llvm_unreachable (" Unhandled type code!" );
884897 }
@@ -993,6 +1006,9 @@ std::string Intrinsic::getInstTypeCode(Type T, ClassKind CK) const {
9931006 if (T.isBFloat16 ())
9941007 return " bf16" ;
9951008
1009+ if (T.isMFloat8 ())
1010+ return " mfp8" ;
1011+
9961012 if (T.isPoly ())
9971013 typeCode = ' p' ;
9981014 else if (T.isInteger ())
@@ -1030,7 +1046,7 @@ std::string Intrinsic::getBuiltinTypeStr() {
10301046
10311047 Type RetT = getReturnType ();
10321048 if ((LocalCK == ClassI || LocalCK == ClassW) && RetT.isScalar () &&
1033- !RetT.isFloating () && !RetT.isBFloat16 ())
1049+ !RetT.isFloating () && !RetT.isBFloat16 () && !RetT. isMFloat8 () )
10341050 RetT.makeInteger (RetT.getElementSizeInBits (), false );
10351051
10361052 // Since the return value must be one type, return a vector type of the
@@ -2587,9 +2603,9 @@ void NeonEmitter::runVectorTypes(raw_ostream &OS) {
25872603 OS << " typedef float float32_t;\n " ;
25882604 OS << " typedef __fp16 float16_t;\n " ;
25892605
2590- OS << " #if defined(__aarch64__) || defined(__arm64ec__)\n " ;
25912606 OS << " typedef __MFloat8x8_t mfloat8x8_t;\n " ;
25922607 OS << " typedef __MFloat8x16_t mfloat8x16_t;\n " ;
2608+ OS << " #if defined(__aarch64__) || defined(__arm64ec__)\n " ;
25932609 OS << " typedef double float64_t;\n " ;
25942610 OS << " #endif\n\n " ;
25952611
0 commit comments