Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit 2e0ff8d

Browse files
author
Dylan McKay
committed
[AVR] Promote i1 ZEXTs to i8
Previously, this would cause an ISel error.
1 parent c737a46 commit 2e0ff8d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/Target/AVR/AVRISelLowering.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ AVRTargetLowering::AVRTargetLowering(AVRTargetMachine &tm)
5151
setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i16, Expand);
5252

5353
for (MVT VT : MVT::integer_valuetypes()) {
54-
setLoadExtAction(ISD::EXTLOAD, VT, MVT::i8, Expand);
55-
setLoadExtAction(ISD::SEXTLOAD, VT, MVT::i8, Expand);
56-
setLoadExtAction(ISD::ZEXTLOAD, VT, MVT::i8, Expand);
54+
for (auto N : {ISD::EXTLOAD, ISD::SEXTLOAD, ISD::ZEXTLOAD}) {
55+
setLoadExtAction(N, VT, MVT::i1, Promote);
56+
setLoadExtAction(N, VT, MVT::i8, Expand);
57+
}
5758
}
5859

5960
setTruncStoreAction(MVT::i16, MVT::i8, Expand);

test/CodeGen/AVR/zext.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ define i16 @zext2(i8 %x, i8 %y) {
1919
%1 = zext i8 %y to i16
2020
ret i16 %1
2121
}
22+
23+
; zext R25:R24, R24
24+
; eor R25, R25
25+
define i16 @zext_i1(i1 %x) {
26+
; CHECK-LABEL: zext_i1:
27+
; CHECK: eor r25, r25
28+
%1 = zext i1 %x to i16
29+
ret i16 %1
30+
}
31+

0 commit comments

Comments
 (0)