Skip to content

Commit 8432eea

Browse files
committed
Draft commit for reviews and questions
1 parent bd5eb78 commit 8432eea

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
9393
setOperationAction(ISD::LOAD, T, Custom);
9494
setOperationAction(ISD::STORE, T, Custom);
9595
}
96+
97+
setOperationAction(ISD::LOAD, MVT::i128, Custom);
9698
}
9799
if (Subtarget->hasFP16()) {
98100
setOperationAction(ISD::LOAD, MVT::v8f16, Custom);
@@ -1609,6 +1611,19 @@ void WebAssemblyTargetLowering::ReplaceNodeResults(
16091611
case ISD::SUB:
16101612
Results.push_back(Replace128Op(N, DAG));
16111613
break;
1614+
case ISD::STORE:
1615+
// TODO: I think i can get away with just LOAD for now
1616+
break;
1617+
case ISD::LOAD: {
1618+
LoadSDNode *LD = cast<LoadSDNode>(N);
1619+
EVT VT = LD->getValueType(0);
1620+
assert(VT == MVT::i128);
1621+
SDValue Pair = DAG.getLoad(MVT::v2i64, SDLoc(LD), LD->getChain(),
1622+
LD->getBasePtr(), LD->getMemOperand());
1623+
Results.push_back(Pair.getValue(0));
1624+
Results.push_back(Pair.getValue(1));
1625+
break;
1626+
}
16121627
default:
16131628
llvm_unreachable(
16141629
"ReplaceNodeResults not implemented for this op for WebAssembly!");

llvm/test/CodeGen/WebAssembly/simd-load-custom-128.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ define void @i128_to_v128(ptr %ptr) {
66
; CHECK-LABEL: i128_to_v128:
77
; CHECK: .functype i128_to_v128 (i32) -> ()
88
; CHECK-NEXT: # %bb.0:
9-
; CHECK-NEXT: i64.load $push0=, 0($0)
10-
; CHECK-NEXT: i64.store 0($0), $pop0
11-
; CHECK-NEXT: i64.load $push1=, 8($0)
12-
; CHECK-NEXT: i64.store 8($0), $pop1
9+
; CHECK-NEXT: v128.load $push0=, 0($0)
10+
; CHECK-NEXT: v128.store 0($0), $pop0
1311
; CHECK-NEXT: return
1412
%2 = load i128, ptr %ptr
1513
store volatile i128 %2, ptr %ptr

0 commit comments

Comments
 (0)