@@ -6008,15 +6008,15 @@ SDValue RISCVTargetLowering::lowerVPCttzElements(SDValue Op,
60086008/// `cfromptr(auth, addr)` is `addr ? csetaddr(auth, addr) : 0` which is
60096009/// semantic change but it is consistent with Morello when CCTLR.DDCBO==0.
60106010static SDValue emitCFromPtrReplacement(SelectionDAG &DAG, const SDLoc &DL,
6011- SDValue Base, SDValue IntVal,
6012- EVT CLenVT ) {
6013- SDValue AsCap = DAG.getNode(
6014- ISD::INTRINSIC_WO_CHAIN, DL, CLenVT,
6015- DAG.getConstant(Intrinsic::cheri_cap_address_set, DL, MVT::i64), Base ,
6016- IntVal);
6017- return DAG.getSelectCC(DL, IntVal,
6018- DAG.getConstant(0, DL, IntVal.getValueType()), AsCap,
6019- DAG.getNullCapability(DL), ISD::SETNE);
6011+ SDValue Base, SDValue IntVal, EVT CLenVT ,
6012+ EVT XLenVT ) {
6013+ SDValue AsCap =
6014+ DAG.getNode( ISD::INTRINSIC_WO_CHAIN, DL, CLenVT,
6015+ DAG.getConstant(Intrinsic::cheri_cap_address_set, DL, XLenVT) ,
6016+ Base, IntVal);
6017+ return DAG.getSelectCC(DL, IntVal,
6018+ DAG.getConstant(0, DL, IntVal.getValueType()), AsCap,
6019+ DAG.getNullCapability(DL), ISD::SETNE);
60206020}
60216021
60226022/// The CToPtr instruction is deprecated and will be removed. This function
@@ -6919,7 +6919,8 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
69196919 }
69206920 SDLoc DL(Op);
69216921 EVT CLenVT = Op.getValueType();
6922- auto GetDDC = DAG.getConstant(Intrinsic::cheri_ddc_get, DL, MVT::i64);
6922+ MVT XLenVT = Subtarget.getXLenVT();
6923+ auto GetDDC = DAG.getConstant(Intrinsic::cheri_ddc_get, DL, XLenVT);
69236924 auto DDC = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, CapType, GetDDC);
69246925 // It would be nice if we could just use SetAddr on DDC, but for
69256926 // consistency between constant inttoptr and non-constant inttoptr
@@ -6928,7 +6929,7 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
69286929 // getting different values for inttoptr with a constant zero argument and
69296930 // inttoptr with a variable that happens to be zero (the latter should not
69306931 // result in a tagged value).
6931- return emitCFromPtrReplacement(DAG, DL, DDC, Op0, CLenVT);
6932+ return emitCFromPtrReplacement(DAG, DL, DDC, Op0, CLenVT, XLenVT );
69326933 }
69336934 return Op;
69346935 }
@@ -10066,7 +10067,8 @@ SDValue RISCVTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
1006610067 // Expand CFromPtr if the dedicated instruction has been removed.
1006710068 if (Subtarget.hasCheriISAv9Semantics()) {
1006810069 return emitCFromPtrReplacement(DAG, DL, Op.getOperand(1),
10069- Op.getOperand(2), Op.getValueType());
10070+ Op.getOperand(2), Op.getValueType(),
10071+ XLenVT);
1007010072 }
1007110073 break;
1007210074 case Intrinsic::cheri_cap_to_pointer:
0 commit comments