Skip to content

Commit 5581ba7

Browse files
authored
Handle padding in FpUnaryOpVerticalZip::toSMT (#1218)
1 parent e38eed6 commit 5581ba7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

ir/instr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,10 +1287,11 @@ StateValue FpUnaryOpVerticalZip::toSMT(State &s) const {
12871287
v2s.emplace_back(std::move(v2));
12881288
}
12891289
auto retty = getType().getAsAggregateType();
1290+
unsigned v2idx = 1 + retty->isPadding(1);
12901291
vals.emplace_back(
12911292
retty->getChild(0).getAsAggregateType()->aggregateVals(v1s));
12921293
vals.emplace_back(
1293-
retty->getChild(1).getAsAggregateType()->aggregateVals(v2s));
1294+
retty->getChild(v2idx).getAsAggregateType()->aggregateVals(v2s));
12941295
} else {
12951296
auto [v1, v2] = scalar(v, val->getType());
12961297
vals.emplace_back(std::move(v1));

tests/alive-tv/fp/frexp.srctgt.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,21 @@ define { half, i32 } @src() {
66
define { half, i32 } @tgt() {
77
ret { half, i32 } zeroinitializer
88
}
9+
10+
define <2 x half> @src2(<2 x half> %h) {
11+
%r = call { <2 x half>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x half> %h)
12+
%e0 = extractvalue { <2 x half>, <2 x i32> } %r, 0
13+
ret <2 x half> %e0
14+
}
15+
16+
define <2 x half> @tgt2(<2 x half> %h) {
17+
%h.i0 = extractelement <2 x half> %h, i64 0
18+
%r.i0 = call { half, i32 } @llvm.frexp.f16.i32(half %h.i0)
19+
%h.i1 = extractelement <2 x half> %h, i64 1
20+
%r.i1 = call { half, i32 } @llvm.frexp.f16.i32(half %h.i1)
21+
%e0.elem0 = extractvalue { half, i32 } %r.i0, 0
22+
%e0.elem01 = extractvalue { half, i32 } %r.i1, 0
23+
%e0.upto0 = insertelement <2 x half> poison, half %e0.elem0, i64 0
24+
%e0 = insertelement <2 x half> %e0.upto0, half %e0.elem01, i64 1
25+
ret <2 x half> %e0
26+
}

0 commit comments

Comments
 (0)