[PATCH] D138418: [LoongArch] Add remaining intrinsics for CRC check instructions
Lu Weining via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 22 05:54:20 PST 2022
SixWeining added inline comments.
================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:925-933
+ case Intrinsic::loongarch_crc_w_b_w: {
+ Results.push_back(DAG.getNode(
+ ISD::TRUNCATE, DL, VT,
+ DAG.getNode(LoongArchISD::CRC_W_B_W, DL, MVT::i64,
+ DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op2),
+ DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op3))));
+ Results.push_back(N->getOperand(0));
----------------
Can we define a marco but not repeating similar codes?
For example:
```
#define CRC_CASE(NAME, ISD) \
case Intrinsic::loongarch_#NAME: { \
Results.push_back(DAG.getNode( \
ISD::TRUNCATE, DL, VT, \
DAG.getNode(LoongArchISD::#ISD, DL, MVT::i64, \
DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op2), \
DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i64, Op3)))); \
Results.push_back(N->getOperand(0)); \
break; \
}
```
Then
```
CRC_CASE(crc_w_b_w, CRC_W_B_W)
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138418/new/
https://reviews.llvm.org/D138418
More information about the cfe-commits
mailing list