Skip to content

Commit 2e1809f

Browse files
authored
[SPARC][IAS] Add definitions for UA 2005 instructions
Reviewers: rorth, s-barannikov, brad0 Reviewed By: s-barannikov Pull Request: llvm#138400
1 parent 20984d8 commit 2e1809f

File tree

5 files changed

+71
-4
lines changed

5 files changed

+71
-4
lines changed

llvm/lib/Target/Sparc/Sparc.td

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def FeatureVIS2
4949
def FeatureVIS3
5050
: SubtargetFeature<"vis3", "IsVIS3", "true",
5151
"Enable Visual Instruction Set extensions III">;
52+
def FeatureUA2005
53+
: SubtargetFeature<"ua2005", "IsUA2005", "true",
54+
"Enable UltraSPARC Architecture 2005 extensions">;
5255
def FeatureLeon
5356
: SubtargetFeature<"leon", "IsLeon", "true",
5457
"Enable LEON extensions">;
@@ -152,13 +155,15 @@ def : Proc<"ultrasparc3", [FeatureV9, FeatureV8Deprecated, FeatureVIS,
152155
FeatureVIS2],
153156
[TuneSlowRDPC]>;
154157
def : Proc<"niagara", [FeatureV9, FeatureV8Deprecated, FeatureVIS,
155-
FeatureVIS2]>;
158+
FeatureVIS2, FeatureUA2005]>;
156159
def : Proc<"niagara2", [FeatureV9, FeatureV8Deprecated, UsePopc,
157-
FeatureVIS, FeatureVIS2]>;
160+
FeatureVIS, FeatureVIS2, FeatureUA2005]>;
158161
def : Proc<"niagara3", [FeatureV9, FeatureV8Deprecated, UsePopc,
159-
FeatureVIS, FeatureVIS2, FeatureVIS3]>;
162+
FeatureVIS, FeatureVIS2, FeatureVIS3,
163+
FeatureUA2005]>;
160164
def : Proc<"niagara4", [FeatureV9, FeatureV8Deprecated, UsePopc,
161-
FeatureVIS, FeatureVIS2, FeatureVIS3]>;
165+
FeatureVIS, FeatureVIS2, FeatureVIS3,
166+
FeatureUA2005]>;
162167

163168
// LEON 2 FT generic
164169
def : Processor<"leon2", LEON2Itineraries,

llvm/lib/Target/Sparc/SparcInstrInfo.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def HasVIS2 : Predicate<"Subtarget->isVIS2()">,
4747
def HasVIS3 : Predicate<"Subtarget->isVIS3()">,
4848
AssemblerPredicate<(all_of FeatureVIS3)>;
4949

50+
// HasUA2005 - This is true when the target processor has UA 2005 extensions.
51+
def HasUA2005 : Predicate<"Subtarget->isUA2005()">,
52+
AssemblerPredicate<(all_of FeatureUA2005)>;
53+
5054
// HasHardQuad - This is true when the target processor supports quad floating
5155
// point instructions.
5256
def HasHardQuad : Predicate<"Subtarget->hasHardQuad()">;
@@ -1971,4 +1975,5 @@ def : Pat<(build_vector (i32 IntRegs:$a1), (i32 IntRegs:$a2)),
19711975

19721976
include "SparcInstr64Bit.td"
19731977
include "SparcInstrVIS.td"
1978+
include "SparcInstrUAOSA.td"
19741979
include "SparcInstrAliases.td"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//=== SparcInstrUAOSA.td - UltraSPARC/Oracle SPARC Architecture extensions ===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file contains instruction formats, definitions and patterns needed for
10+
// UA 2005 instructions on SPARC.
11+
//===----------------------------------------------------------------------===//
12+
13+
class UA2005RegWin<string asmstr, bits<5> fcn>
14+
: F3_1<2, 0b110001, (outs), (ins), asmstr, []> {
15+
let rd = fcn;
16+
let rs1 = 0;
17+
let rs2 = 0;
18+
}
19+
20+
// UltraSPARC Architecture 2005 Instructions
21+
let Predicates = [HasUA2005] in {
22+
let hasSideEffects = 1 in {
23+
def ALLCLEAN : UA2005RegWin<"allclean", 0b00010>;
24+
def INVALW : UA2005RegWin<"invalw", 0b00101>;
25+
def NORMALW : UA2005RegWin<"normalw", 0b00100>;
26+
def OTHERW : UA2005RegWin<"otherw", 0b00011>;
27+
}
28+
} // Predicates = [HasUA2005]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# RUN: llvm-mc --disassemble %s -triple=sparcv9-unknown-linux -mattr=+ua2005 | FileCheck %s
2+
3+
## UA 2005 instructions.
4+
5+
# CHECK: allclean
6+
0x85,0x88,0x00,0x00
7+
# CHECK: invalw
8+
0x8b,0x88,0x00,0x00
9+
# CHECK: otherw
10+
0x87,0x88,0x00,0x00
11+
# CHECK: normalw
12+
0x89,0x88,0x00,0x00

llvm/test/MC/Sparc/sparc-ua2005.s

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
! RUN: not llvm-mc %s -triple=sparcv9 -show-encoding 2>&1 | FileCheck %s --check-prefixes=NO-UA2005 --implicit-check-not=error:
2+
! RUN: llvm-mc %s -triple=sparcv9 -mattr=+ua2005 -show-encoding | FileCheck %s --check-prefixes=UA2005
3+
4+
!! UA 2005 instructions.
5+
6+
! NO-UA2005: error: instruction requires a CPU feature not currently enabled
7+
! UA2005: allclean ! encoding: [0x85,0x88,0x00,0x00]
8+
allclean
9+
! NO-UA2005: error: instruction requires a CPU feature not currently enabled
10+
! UA2005: invalw ! encoding: [0x8b,0x88,0x00,0x00]
11+
invalw
12+
! NO-UA2005: error: instruction requires a CPU feature not currently enabled
13+
! UA2005: otherw ! encoding: [0x87,0x88,0x00,0x00]
14+
otherw
15+
! NO-UA2005: error: instruction requires a CPU feature not currently enabled
16+
! UA2005: normalw ! encoding: [0x89,0x88,0x00,0x00]
17+
normalw

0 commit comments

Comments
 (0)