[clang] [compiler-rt] [llvm] [X86] AVX10_V2_AUX Implementation (PR #206888)

via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 13:48:00 PDT 2026


================
@@ -5042,6 +5063,301 @@ let Features = "avx10.2", Attributes = [NoThrow, Const, RequiredVectorWidth<512>
   def vgetmantbf16512_mask : X86Builtin<"_Vector<32, __bf16>(_Vector<32, __bf16>, _Constant int, _Vector<32, __bf16>, unsigned int)">;
 }
 
+// AVX10 V2 AUX - Convert instructions
+
+// Convert from FP32 to FP8
+
+// VCVTPS2BF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtps2bf8_128 : X86Builtin<"_Vector<16, char>(_Vector<4, float>)">;
+  def vcvtps2bf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtps2bf8_256 : X86Builtin<"_Vector<16, char>(_Vector<8, float>)">;
+  def vcvtps2bf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtps2bf8_512 : X86Builtin<"_Vector<16, char>(_Vector<16, float>)">;
+}
+
+// VCVTPS2BF8S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtps2bf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<4, float>)">;
+  def vcvtps2bf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtps2bf8s_256 : X86Builtin<"_Vector<16, char>(_Vector<8, float>)">;
+  def vcvtps2bf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtps2bf8s_512 : X86Builtin<"_Vector<16, char>(_Vector<16, float>)">;
+}
+
+// VCVTPS2HF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtps2hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<4, float>)">;
+  def vcvtps2hf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtps2hf8_256 : X86Builtin<"_Vector<16, char>(_Vector<8, float>)">;
+  def vcvtps2hf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtps2hf8_512 : X86Builtin<"_Vector<16, char>(_Vector<16, float>)">;
+}
+
+// VCVTPS2HF8S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtps2hf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<4, float>)">;
+  def vcvtps2hf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtps2hf8s_256 : X86Builtin<"_Vector<16, char>(_Vector<8, float>)">;
+  def vcvtps2hf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtps2hf8s_512 : X86Builtin<"_Vector<16, char>(_Vector<16, float>)">;
+}
+
+// VCVTROPS2HF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtrops2hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<4, float>)">;
+  def vcvtrops2hf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtrops2hf8_256 : X86Builtin<"_Vector<16, char>(_Vector<8, float>)">;
+  def vcvtrops2hf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtrops2hf8_512 : X86Builtin<"_Vector<16, char>(_Vector<16, float>)">;
+}
+
+// VCVTROPS2HF8S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtrops2hf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<4, float>)">;
+  def vcvtrops2hf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtrops2hf8s_256 : X86Builtin<"_Vector<16, char>(_Vector<8, float>)">;
+  def vcvtrops2hf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtrops2hf8s_512 : X86Builtin<"_Vector<16, char>(_Vector<16, float>)">;
+}
+
+// Convert from FP32 to FP8 with bias
+
+// VCVTBIASPS2BF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbiasps2bf8_128 : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>)">;
+  def vcvtbiasps2bf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbiasps2bf8_256 : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>)">;
+  def vcvtbiasps2bf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbiasps2bf8_512 : X86Builtin<"_Vector<16, char>(_Vector<16, int>, _Vector<16, float>)">;
+}
+
+// VCVTBIASPS2BF8S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbiasps2bf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>)">;
+  def vcvtbiasps2bf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbiasps2bf8s_256 : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>)">;
+  def vcvtbiasps2bf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbiasps2bf8s_512 : X86Builtin<"_Vector<16, char>(_Vector<16, int>, _Vector<16, float>)">;
+}
+
+// VCVTBIASPS2HF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbiasps2hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>)">;
+  def vcvtbiasps2hf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbiasps2hf8_256 : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>)">;
+  def vcvtbiasps2hf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbiasps2hf8_512 : X86Builtin<"_Vector<16, char>(_Vector<16, int>, _Vector<16, float>)">;
+}
+
+// VCVTBIASPS2HF8S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbiasps2hf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>)">;
+  def vcvtbiasps2hf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<4, int>, _Vector<4, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbiasps2hf8s_256 : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>)">;
+  def vcvtbiasps2hf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<8, int>, _Vector<8, float>, _Vector<16, char>, unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbiasps2hf8s_512 : X86Builtin<"_Vector<16, char>(_Vector<16, int>, _Vector<16, float>)">;
+}
+
+// Convert from FP8 to FP32
+
+// VCVTBF82PS
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbf82ps_128 : X86Builtin<"_Vector<4, float>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbf82ps_256 : X86Builtin<"_Vector<8, float>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbf82ps_512 : X86Builtin<"_Vector<16, float>(_Vector<16, char>)">;
+}
+
+// VCVTHF82PS
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvthf82ps_128 : X86Builtin<"_Vector<4, float>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvthf82ps_256 : X86Builtin<"_Vector<8, float>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvthf82ps_512 : X86Builtin<"_Vector<16, float>(_Vector<16, char>)">;
+}
+
+// Convert from FP8 to FP6
+
+// VCVTBF82BF6S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbf82bf6s_128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbf82bf6s_256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbf82bf6s_512 : X86Builtin<"_Vector<64, char>(_Vector<64, char>)">;
+}
+
+// VCVTHF82HF6S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvthf82hf6s_128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvthf82hf6s_256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvthf82hf6s_512 : X86Builtin<"_Vector<64, char>(_Vector<64, char>)">;
+}
+
+// Convert from FP4 to FP8 and from FP6 to FP8
+
+// VCVTBF42HF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbf42hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbf42hf8_256 : X86Builtin<"_Vector<32, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbf42hf8_512 : X86Builtin<"_Vector<64, char>(_Vector<32, char>)">;
+}
+
+// VCVTBF62HF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbf62hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbf62hf8_256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbf62hf8_512 : X86Builtin<"_Vector<64, char>(_Vector<64, char>)">;
+}
+
+// VCVTHF62HF8
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvthf62hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvthf62hf8_256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvthf62hf8_512 : X86Builtin<"_Vector<64, char>(_Vector<64, char>)">;
+}
+
+// Convert from FP8 to FP4
+
+// VCVTBF82BF4S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvtbf82bf4s_128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvtbf82bf4s_256 : X86Builtin<"_Vector<16, char>(_Vector<32, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvtbf82bf4s_512 : X86Builtin<"_Vector<32, char>(_Vector<64, char>)">;
+}
+
+// VCVTHF82BF4S
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vcvthf82bf4s_128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vcvthf82bf4s_256 : X86Builtin<"_Vector<16, char>(_Vector<32, char>)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vcvthf82bf4s_512 : X86Builtin<"_Vector<32, char>(_Vector<64, char>)">;
+}
+
+// Unpack to Byte
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
+  def vunpackb128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
+  def vunpackb256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant unsigned char)">;
+}
+
+let Features = "avx10v2aux", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
+  def vunpackb512 : X86Builtin<"_Vector<64, char>(_Vector<64, char>, _Constant unsigned char)">;
----------------
ganeshgit wrote:

Haven't changed it as I treated them as shuffle. If you like to change them like converts, please let me know.

https://github.com/llvm/llvm-project/pull/206888


More information about the cfe-commits mailing list