-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[GlobalIsel] Add G_SCMP and G_UCMP instructions #98894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1544,6 +1544,36 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) { | |
|
||
break; | ||
} | ||
case TargetOpcode::G_SCMP: | ||
case TargetOpcode::G_UCMP: { | ||
LLT DstTy = MRI->getType(MI->getOperand(0).getReg()); | ||
LLT SrcTy = MRI->getType(MI->getOperand(1).getReg()); | ||
LLT SrcTy2 = MRI->getType(MI->getOperand(2).getReg()); | ||
|
||
if (SrcTy.isPointerOrPointerVector() || SrcTy2.isPointerOrPointerVector()) { | ||
report("Generic scmp/ucmp does not support pointers as operands", MI); | ||
break; | ||
} | ||
|
||
if (DstTy.isPointerOrPointerVector()) { | ||
report("Generic scmp/ucmp does not support pointers as a result", MI); | ||
break; | ||
} | ||
|
||
if ((DstTy.isVector() != SrcTy.isVector()) || | ||
(DstTy.isVector() && | ||
DstTy.getElementCount() != SrcTy.getElementCount())) { | ||
report("Generic vector scmp/ucmp must preserve number of lanes", MI); | ||
break; | ||
} | ||
|
||
if (SrcTy != SrcTy2) { | ||
report("Generic scmp/ucmp must have same input types", MI); | ||
break; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are pointers valid? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I linked the LangRef PR. Langref claims it is integer-only. |
||
break; | ||
} | ||
case TargetOpcode::G_EXTRACT: { | ||
const MachineOperand &SrcOp = MI->getOperand(1); | ||
if (!SrcOp.isReg()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# RUN: not --crash llc -verify-machineinstrs -run-pass none -mtriple=arm64 -o /dev/null %s 2>&1 | FileCheck %s | ||
# REQUIRES: aarch64-registered-target | ||
|
||
--- | ||
name: test_uscmp | ||
body: | | ||
bb.0: | ||
|
||
%2:_(p0) = G_IMPLICIT_DEF | ||
%3:_(p0) = G_IMPLICIT_DEF | ||
; CHECK: Generic scmp/ucmp does not support pointers as operands | ||
%4:_(s1) = G_SCMP %2, %3 | ||
|
||
%12:_(s64) = G_IMPLICIT_DEF | ||
%13:_(s64) = G_IMPLICIT_DEF | ||
; CHECK: Generic scmp/ucmp does not support pointers as a result | ||
%14:_(p0) = G_SCMP %12, %13 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking the operands separately from the result would be better |
||
|
||
%23:_(<2 x s32>) = G_IMPLICIT_DEF | ||
%24:_(<2 x s32>) = G_IMPLICIT_DEF | ||
; CHECK: Generic vector scmp/ucmp must preserve number of lanes | ||
%5:_(s1) = G_UCMP %23, %24 | ||
|
||
%15:_(s32) = G_CONSTANT i32 0 | ||
%16:_(s64) = G_CONSTANT i64 2 | ||
; CHECK: Generic scmp/ucmp must have same input types | ||
%17:_(s1) = G_SCMP %15, %16 | ||
|
||
|
||
|
||
... |
Uh oh!
There was an error while loading. Please reload this page.