Skip to content

Commit ea625f4

Browse files
authored
[Xtensa] Implement sextload i8 (#106053)
1 parent 0e24c32 commit ea625f4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

llvm/lib/Target/Xtensa/XtensaISelLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ XtensaTargetLowering::XtensaTargetLowering(const TargetMachine &TM,
7070
setOperationAction(ISD::FP_TO_UINT, MVT::i32, Expand);
7171
setOperationAction(ISD::FP_TO_SINT, MVT::i32, Expand);
7272

73-
// No sign extend instructions for i1
73+
// No sign extend instructions for i1 and sign extend load i8
7474
for (MVT VT : MVT::integer_valuetypes()) {
7575
setLoadExtAction(ISD::SEXTLOAD, VT, MVT::i1, Promote);
7676
setLoadExtAction(ISD::ZEXTLOAD, VT, MVT::i1, Promote);
7777
setLoadExtAction(ISD::EXTLOAD, VT, MVT::i1, Promote);
78+
setLoadExtAction(ISD::SEXTLOAD, VT, MVT::i8, Expand);
7879
}
7980

8081
setOperationAction(ISD::ConstantPool, PtrVT, Custom);

llvm/test/CodeGen/Xtensa/load.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc --mtriple=xtensa < %s | FileCheck %s
3+
4+
define signext i8 @test_load_i8(ptr %p){
5+
; CHECK-LABEL: test_load_i8:
6+
; CHECK: l8ui a8, a2, 0
7+
; CHECK-NEXT: slli a8, a8, 24
8+
; CHECK-NEXT: srai a2, a8, 24
9+
; CHECK-NEXT: ret
10+
%1 = load i8, ptr %p, align 1
11+
ret i8 %1
12+
}

0 commit comments

Comments
 (0)