[llvm] 750a78c - [ValueTypes] Add MVT for nxv1bf16.

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 00:51:08 PST 2021


Author: Sander de Smalen
Date: 2021-02-10T08:50:41Z
New Revision: 750a78cd5d4be099ff4e5a75dfd1a1e89176ddf3

URL: https://github.com/llvm/llvm-project/commit/750a78cd5d4be099ff4e5a75dfd1a1e89176ddf3
DIFF: https://github.com/llvm/llvm-project/commit/750a78cd5d4be099ff4e5a75dfd1a1e89176ddf3.diff

LOG: [ValueTypes] Add MVT for nxv1bf16.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D96249

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/ValueTypes.td
    llvm/include/llvm/Support/MachineValueType.h
    llvm/lib/CodeGen/ValueTypes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/ValueTypes.td b/llvm/include/llvm/CodeGen/ValueTypes.td
index 53ebd70dd46a..9330ab69c491 100644
--- a/llvm/include/llvm/CodeGen/ValueTypes.td
+++ b/llvm/include/llvm/CodeGen/ValueTypes.td
@@ -170,36 +170,37 @@ def nxv8i64 : ValueType<512, 136>; // n x  8 x i64 vector value
 def nxv16i64: ValueType<1024,137>; // n x 16 x i64 vector value
 def nxv32i64: ValueType<2048,138>; // n x 32 x i64 vector value
 
-def nxv1f16   : ValueType<16, 139>; // n x   1 x f16 vector value
-def nxv2f16  : ValueType<32 , 140>; // n x  2 x f16 vector value
-def nxv4f16  : ValueType<64 , 141>; // n x  4 x f16 vector value
-def nxv8f16  : ValueType<128, 142>; // n x  8 x f16 vector value
-def nxv16f16  : ValueType<256,143>; // n x  16 x f16 vector value
-def nxv32f16  : ValueType<512,144>; // n x  32 x f16 vector value
-def nxv2bf16 : ValueType<32 , 145>; // n x  2 x bf16 vector value
-def nxv4bf16 : ValueType<64 , 146>; // n x  4 x bf16 vector value
-def nxv8bf16 : ValueType<128, 147>; // n x  8 x bf16 vector value
-def nxv1f32  : ValueType<32 , 148>; // n x  1 x f32 vector value
-def nxv2f32  : ValueType<64 , 149>; // n x  2 x f32 vector value
-def nxv4f32  : ValueType<128, 150>; // n x  4 x f32 vector value
-def nxv8f32  : ValueType<256, 151>; // n x  8 x f32 vector value
-def nxv16f32 : ValueType<512, 152>; // n x 16 x f32 vector value
-def nxv1f64  : ValueType<64,  153>; // n x  1 x f64 vector value
-def nxv2f64  : ValueType<128, 154>; // n x  2 x f64 vector value
-def nxv4f64  : ValueType<256, 155>; // n x  4 x f64 vector value
-def nxv8f64  : ValueType<512, 156>; // n x  8 x f64 vector value
-
-def x86mmx : ValueType<64 , 157>;   // X86 MMX value
-def FlagVT : ValueType<0  , 158>;   // Pre-RA sched glue
-def isVoid : ValueType<0  , 159>;   // Produces no value
-def untyped: ValueType<8  , 160>;   // Produces an untyped value
-def funcref : ValueType<0  , 161>;   // WebAssembly's funcref type
-def externref : ValueType<0  , 162>;   // WebAssembly's externref type
-def x86amx : ValueType<8192, 163>;   // X86 AMX value
+def nxv1f16  : ValueType<16, 139>; // n x  1 x  f16 vector value
+def nxv2f16  : ValueType<32, 140>; // n x  2 x  f16 vector value
+def nxv4f16  : ValueType<64, 141>; // n x  4 x  f16 vector value
+def nxv8f16  : ValueType<128,142>; // n x  8 x  f16 vector value
+def nxv16f16 : ValueType<256,143>; // n x 16 x  f16 vector value
+def nxv32f16 : ValueType<512,144>; // n x 32 x  f16 vector value
+def nxv1bf16 : ValueType<16, 145>; // n x  1 x bf16 vector value
+def nxv2bf16 : ValueType<32, 146>; // n x  2 x bf16 vector value
+def nxv4bf16 : ValueType<64, 147>; // n x  4 x bf16 vector value
+def nxv8bf16 : ValueType<128,148>; // n x  8 x bf16 vector value
+def nxv1f32  : ValueType<32, 149>; // n x  1 x  f32 vector value
+def nxv2f32  : ValueType<64, 150>; // n x  2 x  f32 vector value
+def nxv4f32  : ValueType<128,151>; // n x  4 x  f32 vector value
+def nxv8f32  : ValueType<256,152>; // n x  8 x  f32 vector value
+def nxv16f32 : ValueType<512,153>; // n x 16 x  f32 vector value
+def nxv1f64  : ValueType<64, 154>; // n x  1 x  f64 vector value
+def nxv2f64  : ValueType<128,155>; // n x  2 x  f64 vector value
+def nxv4f64  : ValueType<256,156>; // n x  4 x  f64 vector value
+def nxv8f64  : ValueType<512,157>; // n x  8 x  f64 vector value
+
+def x86mmx : ValueType<64,   158>; // X86 MMX value
+def FlagVT : ValueType<0,    159>; // Pre-RA sched glue
+def isVoid : ValueType<0,    160>; // Produces no value
+def untyped: ValueType<8,    161>; // Produces an untyped value
+def funcref : ValueType<0,   162>; // WebAssembly's funcref type
+def externref : ValueType<0, 163>; // WebAssembly's externref type
+def x86amx : ValueType<8192, 164>; // X86 AMX value
 
 
 def token  : ValueType<0  , 248>;   // TokenTy
-def MetadataVT: ValueType<0, 249>;  // Metadata
+def MetadataVT: ValueType<0,249>;   // Metadata
 
 // Pseudo valuetype mapped to the current pointer size to any address space.
 // Should only be used in TableGen.

diff  --git a/llvm/include/llvm/Support/MachineValueType.h b/llvm/include/llvm/Support/MachineValueType.h
index d4834683e3f6..4075b6dd4bc7 100644
--- a/llvm/include/llvm/Support/MachineValueType.h
+++ b/llvm/include/llvm/Support/MachineValueType.h
@@ -212,18 +212,19 @@ namespace llvm {
       nxv8f16        = 142,  // n x  8 x f16
       nxv16f16       = 143,   // n x  16 x f16
       nxv32f16       = 144,   // n x  32 x f16
-      nxv2bf16       = 145,  // n x  2 x bf16
-      nxv4bf16       = 146,  // n x  4 x bf16
-      nxv8bf16       = 147,  // n x  8 x bf16
-      nxv1f32        = 148,  // n x  1 x f32
-      nxv2f32        = 149,  // n x  2 x f32
-      nxv4f32        = 150,  // n x  4 x f32
-      nxv8f32        = 151,  // n x  8 x f32
-      nxv16f32       = 152,  // n x 16 x f32
-      nxv1f64        = 153,  // n x  1 x f64
-      nxv2f64        = 154,  // n x  2 x f64
-      nxv4f64        = 155,  // n x  4 x f64
-      nxv8f64        = 156,  // n x  8 x f64
+      nxv1bf16       = 145,  // n x  1 x bf16
+      nxv2bf16       = 146,  // n x  2 x bf16
+      nxv4bf16       = 147,  // n x  4 x bf16
+      nxv8bf16       = 148,  // n x  8 x bf16
+      nxv1f32        = 149,  // n x  1 x f32
+      nxv2f32        = 150,  // n x  2 x f32
+      nxv4f32        = 151,  // n x  4 x f32
+      nxv8f32        = 152,  // n x  8 x f32
+      nxv16f32       = 153,  // n x 16 x f32
+      nxv1f64        = 154,  // n x  1 x f64
+      nxv2f64        = 155,  // n x  2 x f64
+      nxv4f64        = 156,  // n x  4 x f64
+      nxv8f64        = 157,  // n x  8 x f64
 
       FIRST_FP_SCALABLE_VECTOR_VALUETYPE = nxv1f16,
       LAST_FP_SCALABLE_VECTOR_VALUETYPE = nxv8f64,
@@ -234,22 +235,22 @@ namespace llvm {
       FIRST_VECTOR_VALUETYPE = v1i1,
       LAST_VECTOR_VALUETYPE  = nxv8f64,
 
-      x86mmx         = 157,   // This is an X86 MMX value
+      x86mmx         = 158,   // This is an X86 MMX value
 
-      Glue           = 158,   // This glues nodes together during pre-RA sched
+      Glue           = 159,   // This glues nodes together during pre-RA sched
 
-      isVoid         = 159,   // This has no value
+      isVoid         = 160,   // This has no value
 
-      Untyped        = 160,   // This value takes a register, but has
+      Untyped        = 161,   // This value takes a register, but has
                               // unspecified type.  The register class
                               // will be determined by the opcode.
 
-      funcref        = 161,   // WebAssembly's funcref type
-      externref      = 162,   // WebAssembly's externref type
-      x86amx         = 163,   // This is an X86 AMX value
+      funcref        = 162,   // WebAssembly's funcref type
+      externref      = 163,   // WebAssembly's externref type
+      x86amx         = 164,   // This is an X86 AMX value
 
       FIRST_VALUETYPE =  1,   // This is always the beginning of the list.
-      LAST_VALUETYPE = 164,   // This always remains at the end of the list.
+      LAST_VALUETYPE = 165,   // This always remains at the end of the list.
 
       // This is the current maximum for LAST_VALUETYPE.
       // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors
@@ -599,6 +600,7 @@ namespace llvm {
       case v32bf16:
       case v64bf16:
       case v128bf16:
+      case nxv1bf16:
       case nxv2bf16:
       case nxv4bf16:
       case nxv8bf16: return bf16;
@@ -781,6 +783,7 @@ namespace llvm {
       case nxv1i32:
       case nxv1i64:
       case nxv1f16:
+      case nxv1bf16:
       case nxv1f32:
       case nxv1f64: return 1;
       }
@@ -840,6 +843,7 @@ namespace llvm {
       case nxv16i1:
       case nxv2i8:
       case nxv1i16:
+      case nxv1bf16:
       case nxv1f16: return TypeSize::Scalable(16);
       case f32 :
       case i32 :
@@ -1277,6 +1281,7 @@ namespace llvm {
           if (NumElements == 32)  return MVT::nxv32f16;
           break;
         case MVT::bf16:
+          if (NumElements == 1)  return MVT::nxv1bf16;
           if (NumElements == 2)  return MVT::nxv2bf16;
           if (NumElements == 4)  return MVT::nxv4bf16;
           if (NumElements == 8)  return MVT::nxv8bf16;

diff  --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp
index 978357d8f539..7e4c4b1c634e 100644
--- a/llvm/lib/CodeGen/ValueTypes.cpp
+++ b/llvm/lib/CodeGen/ValueTypes.cpp
@@ -456,6 +456,8 @@ Type *EVT::getTypeForEVT(LLVMContext &Context) const {
     return ScalableVectorType::get(Type::getHalfTy(Context), 16);
   case MVT::nxv32f16:
     return ScalableVectorType::get(Type::getHalfTy(Context), 32);
+  case MVT::nxv1bf16:
+    return ScalableVectorType::get(Type::getBFloatTy(Context), 1);
   case MVT::nxv2bf16:
     return ScalableVectorType::get(Type::getBFloatTy(Context), 2);
   case MVT::nxv4bf16:


        


More information about the llvm-commits mailing list