1 //===-- SPU.h - Top-level interface for Cell SPU Target ----------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the entry points for global functions defined in the LLVM
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TARGET_IBMCELLSPU_H
16 #define LLVM_TARGET_IBMCELLSPU_H
21 class SPUTargetMachine;
24 FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
25 FunctionPass *createSPUAsmPrinterPass(std::ostream &o, SPUTargetMachine &tm);
27 /*--== Utility functions/predicates/etc used all over the place: --==*/
28 //! Predicate test for a signed 10-bit value
30 \param Value The input value to be tested
32 This predicate tests for a signed 10-bit value, returning the 10-bit value
35 inline bool isS10Constant(short Value) {
36 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
37 return ((Value > 0 && Value <= (1 << 9) - 1)
38 || (Value < 0 && (short) SExtValue == Value));
41 inline bool isS10Constant(int Value) {
42 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
45 inline bool isS10Constant(uint32_t Value) {
46 return (Value <= ((1 << 9) - 1));
49 inline bool isS10Constant(int64_t Value) {
50 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
53 inline bool isS10Constant(uint64_t Value) {
54 return (Value <= ((1 << 9) - 1));
57 //! Predicate test for an unsigned 10-bit value
59 \param Value The input value to be tested
61 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
64 inline bool isU10Constant(short Value) {
65 return (Value == (Value & 0x3ff));
68 inline bool isU10Constant(int Value) {
69 return (Value == (Value & 0x3ff));
72 inline bool isU10Constant(uint32_t Value) {
73 return (Value == (Value & 0x3ff));
76 inline bool isU10Constant(int64_t Value) {
77 return (Value == (Value & 0x3ff));
80 inline bool isU10Constant(uint64_t Value) {
81 return (Value == (Value & 0x3ff));
85 // Defines symbolic names for the SPU instructions.
87 #include "SPUGenInstrNames.inc"
89 #endif /* LLVM_TARGET_IBMCELLSPU_H */