Skip to content

Commit 6741ef3

Browse files
committed
[KeyInstr][Clang] matrix store atom
1 parent 94dc187 commit 6741ef3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "clang/Basic/TargetInfo.h"
3030
#include "clang/Basic/TargetOptions.h"
3131
#include "clang/Frontend/FrontendDiagnostic.h"
32+
#include "llvm/ADT/ScopeExit.h"
3233
#include "llvm/IR/InlineAsm.h"
3334
#include "llvm/IR/Intrinsics.h"
3435
#include "llvm/IR/IntrinsicsX86.h"
@@ -3938,6 +3939,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
39383939
Matrix, Dst.emitRawPointer(*this),
39393940
Align(Dst.getAlignment().getQuantity()), Stride, IsVolatile,
39403941
MatrixTy->getNumRows(), MatrixTy->getNumColumns());
3942+
addInstToNewSourceAtom(cast<llvm::Instruction>(Result), nullptr);
39413943
return RValue::get(Result);
39423944
}
39433945

clang/test/KeyInstructions/builtin.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11

2-
// RUN: %clang -gkey-instructions -x c++ %s -gmlt -gno-column-info -S -emit-llvm -o - -ftrivial-auto-var-init=zero \
2+
// RUN: %clang -gkey-instructions -x c++ %s -gmlt -gno-column-info -S -emit-llvm -o - -ftrivial-auto-var-init=zero -fenable-matrix -Xclang -disable-llvm-passes \
33
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
44

5-
// RUN: %clang -gkey-instructions -x c %s -gmlt -gno-column-info -S -emit-llvm -o - -ftrivial-auto-var-init=zero \
5+
// RUN: %clang -gkey-instructions -x c %s -gmlt -gno-column-info -S -emit-llvm -o - -ftrivial-auto-var-init=zero -fenable-matrix -Xclang -disable-llvm-passes \
66
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
77

8+
typedef float m2x2 __attribute__((matrix_type(2, 2)));
9+
m2x2 mat;
10+
float f4[4];
11+
812
void fun() {
913
// CHECK: %a = alloca ptr, align 8
1014
// CHECK: %0 = alloca i8, i64 4{{.*}}, !dbg [[G1R2:!.*]]
@@ -16,9 +20,13 @@ void fun() {
1620
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G2R1:!.*]], !annotation
1721
// CHECK: store ptr %1, ptr %b{{.*}}, !dbg [[G2R1:!.*]]
1822
void *b = __builtin_alloca_with_align(4, 8);
23+
24+
// CHECK: call void @llvm.matrix.column.major.store.v4f32{{.*}}, !dbg [[G3R1:!.*]]
25+
__builtin_matrix_column_major_store(mat, f4, sizeof(float) * 2);
1926
}
2027

2128
// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
2229
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
2330
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
2431
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
32+
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)

0 commit comments

Comments
 (0)