|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | +; RUN: opt -passes='lower-matrix-intrinsics' -S < %s | FileCheck %s |
| 3 | +; RUN: opt -passes=lower-matrix-intrinsics -pass-remarks-missed=lower-matrix-intrinsics < %s -pass-remarks-output=%t -disable-output && FileCheck --input-file %t %s --check-prefix=REMARK |
| 4 | + |
| 5 | +define void @diag_3x3(ptr %in, ptr %out) { |
| 6 | +; REMARK-LABEL: Name: unknown-shape-lowering |
| 7 | +; REMARK-NEXT: Function: diag_3x3 |
| 8 | +; REMARK-NEXT: Args: |
| 9 | +; REMARK-NEXT: - String: 'flattening a ' |
| 10 | +; REMARK-NEXT: - Rows: '3' |
| 11 | +; REMARK-NEXT: - String: x |
| 12 | +; REMARK-NEXT: - Cols: '3' |
| 13 | +; REMARK-NEXT: - String: ' matrix because we do not have a shape-aware lowering for its user:' |
| 14 | +; REMARK-NEXT: - Instr: ' %diag = shufflevector <9 x float> %inv, <9 x float> poison, <3 x i32> <i32 0, i32 4, i32 8>' |
| 15 | +; REMARK-NEXT: - Opcode: shufflevector |
| 16 | +; REMARK-NEXT: ... |
| 17 | +; CHECK-LABEL: @diag_3x3( |
| 18 | +; CHECK-NEXT: [[COL_LOAD:%.*]] = load <3 x float>, ptr [[IN:%.*]], align 4 |
| 19 | +; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr float, ptr [[IN]], i64 3 |
| 20 | +; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <3 x float>, ptr [[VEC_GEP]], align 4 |
| 21 | +; CHECK-NEXT: [[VEC_GEP2:%.*]] = getelementptr float, ptr [[IN]], i64 6 |
| 22 | +; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <3 x float>, ptr [[VEC_GEP2]], align 4 |
| 23 | +; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <3 x float> [[COL_LOAD]], <3 x float> [[COL_LOAD1]], <6 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5> |
| 24 | +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <3 x float> [[COL_LOAD3]], <3 x float> poison, <6 x i32> <i32 0, i32 1, i32 2, i32 poison, i32 poison, i32 poison> |
| 25 | +; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <6 x float> [[TMP1]], <6 x float> [[TMP2]], <9 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8> |
| 26 | +; CHECK-NEXT: [[DIAG:%.*]] = shufflevector <9 x float> [[TMP3]], <9 x float> poison, <3 x i32> <i32 0, i32 4, i32 8> |
| 27 | +; CHECK-NEXT: store <3 x float> [[DIAG]], ptr [[OUT:%.*]], align 16 |
| 28 | +; CHECK-NEXT: ret void |
| 29 | +; |
| 30 | + %inv = call <9 x float> @llvm.matrix.column.major.load(ptr %in, i64 3, i1 false, i32 3, i32 3) |
| 31 | + %diag = shufflevector <9 x float> %inv, <9 x float> poison, <3 x i32> <i32 0, i32 4, i32 8> |
| 32 | + store <3 x float> %diag, ptr %out |
| 33 | + ret void |
| 34 | +} |
0 commit comments