Skip to content

Conversation

@Priyanshu3820
Copy link
Contributor

Related to: #167765

@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Dec 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 20, 2025

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: Priyanshu Kumar (Priyanshu3820)

Changes

Related to: #167765


Full diff: https://github.com/llvm/llvm-project/pull/173143.diff

2 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp (+52-3)
  • (added) clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c (+80)
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
index 75bf25b20f1af..59d467da3a9fb 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
@@ -362,6 +362,27 @@ static mlir::Value emitX86Muldq(CIRGenBuilderTy &builder, mlir::Location loc,
   return builder.createMul(loc, lhs, rhs);
 }
 
+static mlir::Value emitX86CvtF16ToFloatExpr(CIRGenBuilderTy &builder,
+                                            mlir::Location loc,
+                                            mlir::Type dstTy,
+                                            SmallVectorImpl<mlir::Value> &ops) {
+
+  mlir::Value src = ops[0];
+  mlir::Value passthru = ops[1];
+
+  auto vecTy = mlir::cast<cir::VectorType>(src.getType());
+  uint64_t numElems = vecTy.getSize();
+
+  mlir::Value mask = getMaskVecValue(builder, loc, ops[2], numElems);
+
+  auto halfTy = cir::VectorType::get(builder.getF16Type(), numElems);
+  mlir::Value srcF16 = builder.createBitcast(loc, src, halfTy);
+
+  mlir::Value res = builder.createFloatingCast(srcF16, dstTy);
+
+  return emitX86Select(builder, loc, mask, res, passthru);
+}
+
 static mlir::Value emitX86vpcom(CIRGenBuilderTy &builder, mlir::Location loc,
                                 llvm::SmallVector<mlir::Value> ops,
                                 bool isSigned) {
@@ -1662,12 +1683,40 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
   case X86::BI__builtin_ia32_cmpnltsd:
   case X86::BI__builtin_ia32_cmpnlesd:
   case X86::BI__builtin_ia32_cmpordsd:
+    cgm.errorNYI(expr->getSourceRange(),
+                 std::string("unimplemented X86 builtin call: ") +
+                     getContext().BuiltinInfo.getName(builtinID));
+    return mlir::Value{};
   case X86::BI__builtin_ia32_vcvtph2ps_mask:
   case X86::BI__builtin_ia32_vcvtph2ps256_mask:
-  case X86::BI__builtin_ia32_vcvtph2ps512_mask:
-  case X86::BI__builtin_ia32_cvtneps2bf16_128_mask:
+  case X86::BI__builtin_ia32_vcvtph2ps512_mask: {
+    mlir::Location loc = getLoc(expr->getExprLoc());
+    return emitX86CvtF16ToFloatExpr(builder, loc, convertType(expr->getType()),
+                                    ops);
+  }
+  case X86::BI__builtin_ia32_cvtneps2bf16_128_mask: {
+    mlir::Location loc = getLoc(expr->getExprLoc());
+    mlir::Value intrinsicMask = getMaskVecValue(builder, loc, ops[2], 4);
+    return emitIntrinsicCallOp(builder, loc,
+                               "x86.avx512bf16.mask.cvtneps2bf16.128",
+                               convertType(expr->getType()),
+                               mlir::ValueRange{ops[0], ops[1], intrinsicMask});
+  }
   case X86::BI__builtin_ia32_cvtneps2bf16_256_mask:
-  case X86::BI__builtin_ia32_cvtneps2bf16_512_mask:
+  case X86::BI__builtin_ia32_cvtneps2bf16_512_mask: {
+    mlir::Location loc = getLoc(expr->getExprLoc());
+    unsigned numElts = cast<cir::VectorType>(ops[1].getType()).getSize();
+    mlir::Value selectMask = getMaskVecValue(builder, loc, ops[2], numElts);
+    StringRef intrinsicName;
+    if (builtinID == X86::BI__builtin_ia32_cvtneps2bf16_256_mask)
+      intrinsicName = "x86.avx512bf16.cvtneps2bf16.256";
+    else
+      intrinsicName = "x86.avx512bf16.cvtneps2bf16.512";
+    mlir::Value intrinsicResult =
+        emitIntrinsicCallOp(builder, loc, intrinsicName, ops[1].getType(),
+                            mlir::ValueRange{ops[0]});
+    return emitX86Select(builder, loc, selectMask, intrinsicResult, ops[1]);
+  }
   case X86::BI__cpuid:
   case X86::BI__cpuidex:
   case X86::BI__emul:
diff --git a/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c b/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c
new file mode 100644
index 0000000000000..ccfc0d4a6a813
--- /dev/null
+++ b/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-cir -o %t.cir -Wall -Werror -Wsign-conversion 
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-llvm -o %t.ll -Wall -Werror -Wsign-conversion
+// RUN: FileCheck --check-prefixes=LLVM --input-file=%t.ll %s
+// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -emit-llvm -o %t.ll -Wall -Werror -Wsign-conversion
+// RUN: FileCheck --check-prefixes=OGCG --input-file=%t.ll %s
+
+#include <immintrin.h>
+
+__m256bh test_mm512_mask_cvtneps_pbh(__m256bh src, __mmask16 k, __m512 a) {
+  // CIR-LABEL: @test_mm512_mask_cvtneps_pbh
+  // CIR: cir.call @_mm512_mask_cvtneps_pbh({{.+}}, {{.+}}, {{.+}}) : (!cir.vector<16 x !cir.bf16>, !u16i, !cir.vector<16 x !cir.float>) -> !cir.vector<16 x !cir.bf16>
+
+  // LLVM-LABEL: @test_mm512_mask_cvtneps_pbh
+  // LLVM: call <16 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.512
+
+  // OGCG-LABEL: @test_mm512_mask_cvtneps_pbh
+  // OGCG: call <16 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.512
+  return _mm512_mask_cvtneps_pbh(src, k, a);
+}
+
+__m256bh test_mm512_maskz_cvtneps_pbh(__mmask16 k, __m512 a) {
+  // CIR-LABEL: @test_mm512_maskz_cvtneps_pbh
+  // CIR: cir.call @_mm512_maskz_cvtneps_pbh({{.+}}, {{.+}}) : (!u16i, !cir.vector<16 x !cir.float>) -> !cir.vector<16 x !cir.bf16>
+
+  // LLVM-LABEL: @test_mm512_maskz_cvtneps_pbh
+  // LLVM: call <16 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.512(<16 x float> {{.+}})
+
+  // OGCG-LABEL:  @test_mm512_maskz_cvtneps_pbh
+  // OGCG: call <16 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.512(<16 x float> {{.+}})
+  return _mm512_maskz_cvtneps_pbh(k, a);
+}
+
+__m128bh test_mm256_mask_cvtneps_pbh(__m128bh src, __mmask8 k, __m256 a) {
+  // CIR-LABEL: test_mm256_mask_cvtneps_pbh
+  // CIR: cir.call @_mm256_mask_cvtneps_pbh({{.+}}, {{.+}}, {{.+}}) : (!cir.vector<8 x !cir.bf16>, !u8i, !cir.vector<8 x !cir.float>) -> !cir.vector<8 x !cir.bf16>
+  
+  // LLVM-LABEL: test_mm256_mask_cvtneps_pbh
+  // LLVM: call <8 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.256(<8 x float> {{.+}})
+
+  // OGCG-LABEL: test_mm256_mask_cvtneps_pbh
+  // OGCG: call <8 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.256(<8 x float> {{.+}})  
+  return _mm256_mask_cvtneps_pbh(src, k, a);
+}
+
+__m128bh test_mm256_maskz_cvtneps_pbh(__mmask8 k, __m256 a) {
+  // CIR-LABEL: test_mm256_maskz_cvtneps_pbh
+  // CIR: cir.call @_mm256_maskz_cvtneps_pbh({{.+}}, {{.+}}) : (!u8i, !cir.vector<8 x !cir.float>) -> !cir.vector<8 x !cir.bf16>
+
+  // LLVM-LABEL: test_mm256_maskz_cvtneps_pbh
+  // LLVM: call <8 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.256(<8 x float> {{.+}})
+
+  // OGCG-LABEL: test_mm256_maskz_cvtneps_pbh
+  // OGCG: call <8 x bfloat> @llvm.x86.avx512bf16.cvtneps2bf16.256(<8 x float> {{.+}})
+  return _mm256_maskz_cvtneps_pbh(k, a);
+}
+
+__m128bh test_mm_mask_cvtneps_pbh(__m128bh src, __mmask8 k, __m128 a) {
+  // CIR-LABEL: test_mm_mask_cvtneps_pbh
+  // CIR: cir.call @_mm_mask_cvtneps_pbh({{.+}}, {{.+}}, {{.+}}) : (!cir.vector<8 x !cir.bf16>, !u8i, !cir.vector<4 x !cir.float>) -> !cir.vector<8 x !cir.bf1{{.+}}
+
+  // LLVM-LABEL: test_mm_mask_cvtneps_pbh
+  // LLVM: call <8 x bfloat> @llvm.x86.avx512bf16.mask.cvtneps2bf16.128(<4 x float> {{.+}}, <8 x bfloat> {{.+}}, <4 x i1> %extract.i)
+
+  // OGCG-LABEL: test_mm_mask_cvtneps_pbh
+  // OGCG: call <8 x bfloat> @llvm.x86.avx512bf16.mask.cvtneps2bf16.128(<4 x float> {{.+}}, <8 x bfloat> {{.+}}, <4 x i1> %extract.i)
+  return _mm_mask_cvtneps_pbh(src, k, a);
+}
+
+__m128bh test_mm_maskz_cvtneps_pbh(__mmask8 k, __m128 a) {
+  // CIR-LABEL: test_mm_maskz_cvtneps_pbh
+  // CIR: cir.call @_mm_maskz_cvtneps_pbh({{.+}}, {{.+}}) : (!u8i, !cir.vector<4 x !cir.float>) -> !cir.vector<8 x !cir.bf16>
+  
+  // LLVM-LABEL: test_mm_maskz_cvtneps_pbh
+  // LLVM: call <8 x bfloat> @llvm.x86.avx512bf16.mask.cvtneps2bf16.128(<4 x float> {{.+}}, <8 x bfloat> {{.+}}, <4 x i1> %extract.i)
+
+  // OGCG-LABEL: test_mm_maskz_cvtneps_pbh
+  // OGCG: call <8 x bfloat> @llvm.x86.avx512bf16.mask.cvtneps2bf16.128(<4 x float> {{.+}}, <8 x bfloat> {{.+}}, <4 x i1> %extract.i)
+  return _mm_maskz_cvtneps_pbh(k, a);
+}

@github-actions
Copy link

github-actions bot commented Dec 20, 2025

🐧 Linux x64 Test Results

  • 86082 tests passed
  • 757 tests skipped
  • 2 tests failed

Failed Tests

(click on a test name to see its output)

Clang

Clang.CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c
Exit Code: -6

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -flax-vector-conversions=none -ffreestanding /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-cir -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenBuiltins/X86/Output/avx512vlbf16-builtins.c.tmp.cir -Wall -Werror -Wsign-conversion
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -flax-vector-conversions=none -ffreestanding /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-cir -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenBuiltins/X86/Output/avx512vlbf16-builtins.c.tmp.cir -Wall -Werror -Wsign-conversion
# .---command stderr------------
# | clang: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Casting.h:560: decltype(auto) llvm::cast(const From &) [To = cir::IntType, From = mlir::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -flax-vector-conversions=none -ffreestanding /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-cir -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenBuiltins/X86/Output/avx512vlbf16-builtins.c.tmp.cir -Wall -Werror -Wsign-conversion
# | 1.	<eof> parser at end of file
# |  #0 0x00000000099ba4c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:842:13
# |  #1 0x00000000099b7bd5 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x00000000099bb291 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:429:38
# |  #3 0x00007c2468495330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007c24684eeb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007c246849527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007c24684788ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x00007c246847881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
# |  #8 0x00007c246848b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
# |  #9 0x000000000ab5ece8 getMaskVecValue(clang::CIRGen::CIRGenBuilderTy&, mlir::Location, mlir::Value, unsigned int) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp:0:0
# | #10 0x000000000ab5f0d7 emitX86Select(clang::CIRGen::CIRGenBuilderTy&, mlir::Location, mlir::Value, mlir::Value, mlir::Value) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp:181:8
# | #11 0x000000000ab5b050 clang::CIRGen::CIRGenFunction::emitX86BuiltinExpr(unsigned int, clang::CallExpr const*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp:0:0
# | #12 0x000000000ab548e0 clang::CIRGen::CIRGenFunction::emitTargetBuiltinExpr(unsigned int, clang::CallExpr const*, clang::CIRGen::ReturnValueSlot&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp:1788:1
# | #13 0x000000000ab5184d clang::CIRGen::CIRGenFunction::emitBuiltinExpr(clang::GlobalDecl const&, unsigned int, clang::CallExpr const*, clang::CIRGen::ReturnValueSlot) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp:1690:34
# | #14 0x000000000ab451a6 clang::CIRGen::CIRGenFunction::emitCallExpr(clang::CallExpr const*, clang::CIRGen::ReturnValueSlot) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExpr.cpp:2082:5
# | #15 0x000000000ab8c442 isScalar /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenValue.h:49:41
# | #16 0x000000000ab8c442 getValue /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenValue.h:58:5
# | #17 0x000000000ab8c442 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:2325:32
# | #18 0x000000000ab8f242 Visit /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:130:57
# | #19 0x000000000ab8f242 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:2063:23
# | #20 0x000000000ab82e35 clang::CIRGen::CIRGenFunction::emitScalarExpr(clang::Expr const*, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:1635:3
# | #21 0x000000000abda4bb operator bool /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Value.h:100:43
# | #22 0x000000000abda4bb clang::CIRGen::CIRGenFunction::emitReturnStmt(clang::ReturnStmt const&)::$_0::operator()() const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:598:13
# | #23 0x000000000abd9de3 clang::CIRGen::CIRGenFunction::emitReturnStmt(clang::ReturnStmt const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:620:3
# | #24 0x000000000abd7e0c clang::CIRGen::CIRGenFunction::emitStmt(clang::Stmt const*, bool, llvm::ArrayRef<clang::Attr const*>) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:0:23
# | #25 0x000000000abd7d43 clang::CIRGen::CIRGenFunction::emitCompoundStmtWithoutScope(clang::CompoundStmt const&, clang::CIRGen::Address*, clang::CIRGen::AggValueSlot) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:81:11
# | #26 0x000000000ab95bff emitFunctionBody /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenFunction.cpp:646:12
# | #27 0x000000000ab95bff clang::CIRGen::CIRGenFunction::generateCode(clang::GlobalDecl, cir::FuncOp, cir::FuncType) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenFunction.cpp:764:24
# | #28 0x000000000ab9c968 isSet /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:337:40
# | #29 0x000000000ab9c968 restoreInsertionPoint /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:391:12
# | #30 0x000000000ab9c968 ~InsertionGuard /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:355:18
# | #31 0x000000000ab9c968 clang::CIRGen::CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl, mlir::Operation*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:460:3
# | #32 0x000000000ab9bbef clang::CIRGen::CIRGenModule::emitGlobalDefinition(clang::GlobalDecl, mlir::Operation*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:956:5
# | #33 0x000000000ab9b799 clang::CIRGen::CIRGenModule::emitGlobalDecl(clang::GlobalDecl const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:328:1
# | #34 0x000000000ab9bd64 __normal_iterator /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1077:20
# | #35 0x000000000ab9bd64 begin /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:884:16
# | #36 0x000000000ab9bd64 empty /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:1089:16
# | #37 0x000000000ab9bd64 clang::CIRGen::CIRGenModule::emitDeferred() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:354:30
# | #38 0x000000000aba45af clang::CIRGen::CIRGenModule::release() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:2588:3
# | #39 0x000000000aa0c9a0 cir::CIRGenConsumer::HandleTranslationUnit(clang::ASTContext&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:103:10
# | #40 0x000000000cd07b79 __normal_iterator /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1077:20
# | #41 0x000000000cd07b79 begin /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:874:16
# | #42 0x000000000cd07b79 finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback> >, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback> > > > > /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/Sema/TemplateInstCallback.h:54:16
# | #43 0x000000000cd07b79 clang::ParseAST(clang::Sema&, bool, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Parse/ParseAST.cpp:190:3
# | #44 0x000000000a69a716 clang::FrontendAction::Execute() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1316:10
# | #45 0x000000000a6018ad getPtr /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Error.h:278:42
# | #46 0x000000000a6018ad operator bool /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Error.h:241:16
# | #47 0x000000000a6018ad clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1003:23
# | #48 0x000000000a78d4ef clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:310:25
# | #49 0x0000000006ccba09 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/tools/driver/cc1_main.cpp:304:15
# | #50 0x0000000006cc77a5 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/tools/driver/driver.cpp:225:12
# | #51 0x0000000006cc680d clang_main(int, char**, llvm::ToolContext const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/tools/driver/driver.cpp:268:12
# | #52 0x0000000006cd7837 main /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/driver/clang-driver.cpp:17:10
# | #53 0x00007c246847a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #54 0x00007c246847a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #55 0x0000000006cc51e5 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang+0x6cc51e5)
# `-----------------------------
# error: command failed with exit status: -6

--

Clang.CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c
Exit Code: -6

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -flax-vector-conversions=none -ffreestanding /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-cir -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenBuiltins/X86/Output/avx512vlbf16-builtins.c.tmp.cir -Wall -Werror -Wsign-conversion
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -flax-vector-conversions=none -ffreestanding /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-cir -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenBuiltins/X86/Output/avx512vlbf16-builtins.c.tmp.cir -Wall -Werror -Wsign-conversion
# .---command stderr------------
# | clang: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Casting.h:560: decltype(auto) llvm::cast(const From &) [To = cir::IntType, From = mlir::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/22/include -nostdsysteminc -flax-vector-conversions=none -ffreestanding /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CIR/CodeGenBuiltins/X86/avx512vlbf16-builtins.c -triple=x86_64-unknown-linux -target-feature +avx512f -target-feature +avx512vl -target-feature +avx512bf16 -fclangir -emit-cir -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/test/CIR/CodeGenBuiltins/X86/Output/avx512vlbf16-builtins.c.tmp.cir -Wall -Werror -Wsign-conversion
# | 1.	<eof> parser at end of file
# |  #0 0x00000000099ba4c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:842:13
# |  #1 0x00000000099b7bd5 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x00000000099bb291 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:429:38
# |  #3 0x00007a5617bf5330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007a5617c4eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007a5617bf527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007a5617bd88ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x00007a5617bd881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
# |  #8 0x00007a5617beb517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
# |  #9 0x000000000ab5ece8 getMaskVecValue(clang::CIRGen::CIRGenBuilderTy&, mlir::Location, mlir::Value, unsigned int) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp:0:0
# | #10 0x000000000ab5f0d7 emitX86Select(clang::CIRGen::CIRGenBuilderTy&, mlir::Location, mlir::Value, mlir::Value, mlir::Value) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp:181:8
# | #11 0x000000000ab5b050 clang::CIRGen::CIRGenFunction::emitX86BuiltinExpr(unsigned int, clang::CallExpr const*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp:0:0
# | #12 0x000000000ab548e0 clang::CIRGen::CIRGenFunction::emitTargetBuiltinExpr(unsigned int, clang::CallExpr const*, clang::CIRGen::ReturnValueSlot&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp:1788:1
# | #13 0x000000000ab5184d clang::CIRGen::CIRGenFunction::emitBuiltinExpr(clang::GlobalDecl const&, unsigned int, clang::CallExpr const*, clang::CIRGen::ReturnValueSlot) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp:1690:34
# | #14 0x000000000ab451a6 clang::CIRGen::CIRGenFunction::emitCallExpr(clang::CallExpr const*, clang::CIRGen::ReturnValueSlot) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExpr.cpp:2082:5
# | #15 0x000000000ab8c442 isScalar /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenValue.h:49:41
# | #16 0x000000000ab8c442 getValue /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenValue.h:58:5
# | #17 0x000000000ab8c442 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:2325:32
# | #18 0x000000000ab8f242 Visit /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:130:57
# | #19 0x000000000ab8f242 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:2063:23
# | #20 0x000000000ab82e35 clang::CIRGen::CIRGenFunction::emitScalarExpr(clang::Expr const*, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp:1635:3
# | #21 0x000000000abda4bb operator bool /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Value.h:100:43
# | #22 0x000000000abda4bb clang::CIRGen::CIRGenFunction::emitReturnStmt(clang::ReturnStmt const&)::$_0::operator()() const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:598:13
# | #23 0x000000000abd9de3 clang::CIRGen::CIRGenFunction::emitReturnStmt(clang::ReturnStmt const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:620:3
# | #24 0x000000000abd7e0c clang::CIRGen::CIRGenFunction::emitStmt(clang::Stmt const*, bool, llvm::ArrayRef<clang::Attr const*>) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:0:23
# | #25 0x000000000abd7d43 clang::CIRGen::CIRGenFunction::emitCompoundStmtWithoutScope(clang::CompoundStmt const&, clang::CIRGen::Address*, clang::CIRGen::AggValueSlot) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenStmt.cpp:81:11
# | #26 0x000000000ab95bff emitFunctionBody /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenFunction.cpp:646:12
# | #27 0x000000000ab95bff clang::CIRGen::CIRGenFunction::generateCode(clang::GlobalDecl, cir::FuncOp, cir::FuncType) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenFunction.cpp:764:24
# | #28 0x000000000ab9c968 isSet /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:337:40
# | #29 0x000000000ab9c968 restoreInsertionPoint /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:391:12
# | #30 0x000000000ab9c968 ~InsertionGuard /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:355:18
# | #31 0x000000000ab9c968 clang::CIRGen::CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl, mlir::Operation*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:460:3
# | #32 0x000000000ab9bbef clang::CIRGen::CIRGenModule::emitGlobalDefinition(clang::GlobalDecl, mlir::Operation*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:956:5
# | #33 0x000000000ab9b799 clang::CIRGen::CIRGenModule::emitGlobalDecl(clang::GlobalDecl const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:328:1
# | #34 0x000000000ab9bd64 __normal_iterator /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1077:20
# | #35 0x000000000ab9bd64 begin /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:884:16
# | #36 0x000000000ab9bd64 empty /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:1089:16
# | #37 0x000000000ab9bd64 clang::CIRGen::CIRGenModule::emitDeferred() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:354:30
# | #38 0x000000000aba45af clang::CIRGen::CIRGenModule::release() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/CodeGen/CIRGenModule.cpp:2588:3
# | #39 0x000000000aa0c9a0 cir::CIRGenConsumer::HandleTranslationUnit(clang::ASTContext&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/CIR/FrontendAction/CIRGenAction.cpp:103:10
# | #40 0x000000000cd07b79 __normal_iterator /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_iterator.h:1077:20
# | #41 0x000000000cd07b79 begin /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:874:16
# | #42 0x000000000cd07b79 finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback> >, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback> > > > > /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/Sema/TemplateInstCallback.h:54:16
# | #43 0x000000000cd07b79 clang::ParseAST(clang::Sema&, bool, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Parse/ParseAST.cpp:190:3
# | #44 0x000000000a69a716 clang::FrontendAction::Execute() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1316:10
# | #45 0x000000000a6018ad getPtr /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Error.h:278:42
# | #46 0x000000000a6018ad operator bool /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Error.h:241:16
# | #47 0x000000000a6018ad clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1003:23
# | #48 0x000000000a78d4ef clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:310:25
# | #49 0x0000000006ccba09 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/tools/driver/cc1_main.cpp:304:15
# | #50 0x0000000006cc77a5 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/tools/driver/driver.cpp:225:12
# | #51 0x0000000006cc680d clang_main(int, char**, llvm::ToolContext const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/tools/driver/driver.cpp:268:12
# | #52 0x0000000006cd7837 main /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/driver/clang-driver.cpp:17:10
# | #53 0x00007a5617bda1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #54 0x00007a5617bda28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #55 0x0000000006cc51e5 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang+0x6cc51e5)
# `-----------------------------
# error: command failed with exit status: -6

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants