remove a dead bool.
[llvm/avr.git] / lib / Target / CellSPU / SPU.h
blob02713b5402dafd4368bc58b672853657e8c38f6a
1 //===-- SPU.h - Top-level interface for Cell SPU Target ----------*- C++ -*-==//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the entry points for global functions defined in the LLVM
11 // Cell SPU back-end.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TARGET_IBMCELLSPU_H
16 #define LLVM_TARGET_IBMCELLSPU_H
18 #include "llvm/Support/DataTypes.h"
19 #include "llvm/Target/TargetMachine.h"
21 namespace llvm {
22 class SPUTargetMachine;
23 class FunctionPass;
24 class formatted_raw_ostream;
26 FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
28 /*--== Utility functions/predicates/etc used all over the place: --==*/
29 //! Predicate test for a signed 10-bit value
30 /*!
31 \param Value The input value to be tested
33 This predicate tests for a signed 10-bit value, returning the 10-bit value
34 as a short if true.
36 template<typename T>
37 inline bool isS10Constant(T Value);
39 template<>
40 inline bool isS10Constant<short>(short Value) {
41 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
42 return ((Value > 0 && Value <= (1 << 9) - 1)
43 || (Value < 0 && (short) SExtValue == Value));
46 template<>
47 inline bool isS10Constant<int>(int Value) {
48 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
51 template<>
52 inline bool isS10Constant<uint32_t>(uint32_t Value) {
53 return (Value <= ((1 << 9) - 1));
56 template<>
57 inline bool isS10Constant<int64_t>(int64_t Value) {
58 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
61 template<>
62 inline bool isS10Constant<uint64_t>(uint64_t Value) {
63 return (Value <= ((1 << 9) - 1));
66 //! Predicate test for an unsigned 10-bit value
67 /*!
68 \param Value The input value to be tested
70 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
71 as a short if true.
73 inline bool isU10Constant(short Value) {
74 return (Value == (Value & 0x3ff));
77 inline bool isU10Constant(int Value) {
78 return (Value == (Value & 0x3ff));
81 inline bool isU10Constant(uint32_t Value) {
82 return (Value == (Value & 0x3ff));
85 inline bool isU10Constant(int64_t Value) {
86 return (Value == (Value & 0x3ff));
89 inline bool isU10Constant(uint64_t Value) {
90 return (Value == (Value & 0x3ff));
93 extern Target TheCellSPUTarget;
97 // Defines symbolic names for the SPU instructions.
99 #include "SPUGenInstrNames.inc"
101 #endif /* LLVM_TARGET_IBMCELLSPU_H */