-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[RISCV] Add Xqccmp Assembly Support #128731
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 3 commits
6f8c6d1
1d71256
8162983
7e13372
b33add5
47e63a8
890cd31
009a1cb
607d6f4
cd9d4e3
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 |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| //===---------------- RISCVInstrInfoXqccmp.td --------------*- tablegen -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This file describes Qualcomm's Xqccmp extension. | ||
| // | ||
| // Xqccmp is broadly equivalent to (and incompatible with) Zcmp except the | ||
| // following changes: | ||
| // | ||
| // - The registers are pushed in the opposite order, so `ra` and `fp` are | ||
| // closest to the incoming stack pointer (to be compatible with the | ||
| // frame-pointer convention), and | ||
| // | ||
| // - There is a new `qc.cm.pushfp` instruction which is `qc.cm.push` but it sets | ||
| // `fp` to the incoming stack pointer value, as expected by the frame-pointer | ||
| // convention. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // Operand and SDNode transformation definitions. | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // Instruction Formats | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // Instruction Class Templates | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // Instructions | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // Zcmp | ||
| let DecoderNamespace = "Xqccmp", Predicates = [HasVendorXqccmp], | ||
| hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { | ||
| let Defs = [X10, X11] in | ||
| def QC_CM_MVA01S : RVInst16CA<0b101011, 0b11, 0b10, (outs), | ||
| (ins SR07:$rs1, SR07:$rs2), "qc.cm.mva01s", "$rs1, $rs2">, | ||
| Sched<[WriteIALU, WriteIALU, ReadIALU, ReadIALU]>; | ||
|
|
||
| let Uses = [X10, X11] in | ||
| def QC_CM_MVSA01 : RVInst16CA<0b101011, 0b01, 0b10, (outs SR07:$rs1, SR07:$rs2), | ||
| (ins), "qc.cm.mvsa01", "$rs1, $rs2">, | ||
| Sched<[WriteIALU, WriteIALU, ReadIALU, ReadIALU]>; | ||
| } // DecoderNamespace = "Xqccmp", Predicates = [HasVendorXqccmp]... | ||
|
|
||
| let DecoderNamespace = "Xqccmp", Predicates = [HasVendorXqccmp] in { | ||
| let hasSideEffects = 0, mayLoad = 0, mayStore = 1, Uses = [X2], Defs = [X2] in | ||
| def QC_CM_PUSH : RVInstZcCPPP<0b11000, "qc.cm.push", negstackadj>, | ||
| Sched<[WriteIALU, ReadIALU, ReadStoreData, ReadStoreData, | ||
| ReadStoreData, ReadStoreData, ReadStoreData, ReadStoreData, | ||
| ReadStoreData, ReadStoreData, ReadStoreData, ReadStoreData, | ||
| ReadStoreData, ReadStoreData, ReadStoreData]>; | ||
|
|
||
| let hasSideEffects = 0, mayLoad = 0, mayStore = 1, Uses = [X2], Defs = [X2, X8] in | ||
| def QC_CM_PUSHFP : RVInstZcCPPP<0b11001, "qc.cm.pushfp", negstackadj>, | ||
| Sched<[WriteIALU, WriteIALU, ReadIALU, ReadStoreData, ReadStoreData, | ||
| ReadStoreData, ReadStoreData, ReadStoreData, ReadStoreData, | ||
| ReadStoreData, ReadStoreData, ReadStoreData, ReadStoreData, | ||
| ReadStoreData, ReadStoreData, ReadStoreData]>; | ||
|
|
||
| let hasSideEffects = 0, mayLoad = 1, mayStore = 0, isReturn = 1, | ||
| Uses = [X2], Defs = [X2] in | ||
| def QC_CM_POPRET : RVInstZcCPPP<0b11110, "qc.cm.popret">, | ||
| Sched<[WriteIALU, WriteLDW, WriteLDW, WriteLDW, WriteLDW, | ||
| WriteLDW, WriteLDW, WriteLDW, WriteLDW, WriteLDW, | ||
| WriteLDW, WriteLDW, WriteLDW, WriteLDW, ReadIALU]>; | ||
|
|
||
| let hasSideEffects = 0, mayLoad = 1, mayStore = 0, isReturn = 1, | ||
| Uses = [X2], Defs = [X2, X10] in | ||
| def QC_CM_POPRETZ : RVInstZcCPPP<0b11100, "qc.cm.popretz">, | ||
| Sched<[WriteIALU, WriteIALU, WriteLDW, WriteLDW, WriteLDW, | ||
| WriteLDW, WriteLDW, WriteLDW, WriteLDW, WriteLDW, | ||
| WriteLDW, WriteLDW, WriteLDW, WriteLDW, WriteLDW, | ||
| ReadIALU]>; | ||
|
|
||
| let hasSideEffects = 0, mayLoad = 1, mayStore = 0, | ||
| Uses = [X2], Defs = [X2] in | ||
| def QC_CM_POP : RVInstZcCPPP<0b11010, "qc.cm.pop">, | ||
| Sched<[WriteIALU, WriteLDW, WriteLDW, WriteLDW, WriteLDW, | ||
| WriteLDW, WriteLDW, WriteLDW, WriteLDW, WriteLDW, WriteLDW, | ||
| WriteLDW, WriteLDW, WriteLDW, ReadIALU]>; | ||
| } // DecoderNamespace = "RVZcmp", Predicates = [HasVendorXqccmp]... | ||
|
||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // Aliases | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # RUN: not llvm-mc -triple=riscv32 -mattr=+experimental-xqccmp -M no-aliases -show-encoding < %s 2>&1 \ | ||
| # RUN: | FileCheck -check-prefixes=CHECK-ERROR %s | ||
|
|
||
| # CHECK-ERROR: error: invalid operand for instruction | ||
| qc.cm.mvsa01 a1, a2 | ||
|
|
||
| # CHECK-ERROR: error: rs1 and rs2 must be different | ||
| qc.cm.mvsa01 s0, s0 | ||
|
|
||
| # CHECK-ERROR: error: invalid operand for instruction | ||
| qc.cm.mva01s a1, a2 | ||
|
|
||
| # CHECK-ERROR: error: invalid register list, {ra, s0-s10} or {x1, x8-x9, x18-x26} is not supported | ||
| qc.cm.popretz {ra, s0-s10}, 112 | ||
|
|
||
| # CHECK-ERROR: error: stack adjustment is invalid for this instruction and register list; refer to Zc spec for a detailed range of stack adjustment | ||
|
||
| qc.cm.popretz {ra, s0-s1}, 112 | ||
|
|
||
| # CHECK-ERROR: error: stack adjustment is invalid for this instruction and register list; refer to Zc spec for a detailed range of stack adjustment | ||
| qc.cm.push {ra}, 16 | ||
|
|
||
| # CHECK-ERROR: error: stack adjustment is invalid for this instruction and register list; refer to Zc spec for a detailed range of stack adjustment | ||
| qc.cm.pushfp {ra, s0}, 16 | ||
|
|
||
| # CHECK-ERROR: error: stack adjustment is invalid for this instruction and register list; refer to Zc spec for a detailed range of stack adjustment | ||
| qc.cm.pop {ra, s0-s1}, -32 | ||
|
|
||
| # CHECK-ERROR: error: stack adjustment is invalid for this instruction and register list; refer to Zc spec for a detailed range of stack adjustment | ||
| qc.cm.push {ra}, -8 | ||
|
|
||
| # CHECK-ERROR: error: stack adjustment is invalid for this instruction and register list; refer to Zc spec for a detailed range of stack adjustment | ||
| qc.cm.pushfp {ra, s0}, -12 | ||
|
|
||
| # CHECK-ERROR: error: stack adjustment is invalid for this instruction and register list; refer to Zc spec for a detailed range of stack adjustment | ||
| qc.cm.pop {ra, s0-s1}, -40 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop the Zcmp comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done