[llvm-commits] CVS: llvm/lib/Reoptimizer/BinInterface/bitmath.h sparc9.h

Joel Stanley jstanley at cs.uiuc.edu
Thu Apr 10 00:33:02 PDT 2003


Changes in directory llvm/lib/Reoptimizer/BinInterface:

bitmath.h updated: 1.5 -> 1.6
sparc9.h updated: 1.9 -> 1.10

---
Log message:

Added more instruction-construction macros (must fix integer overflow
warning), and field-extraction macros.


---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/BinInterface/bitmath.h
diff -u llvm/lib/Reoptimizer/BinInterface/bitmath.h:1.5 llvm/lib/Reoptimizer/BinInterface/bitmath.h:1.6
--- llvm/lib/Reoptimizer/BinInterface/bitmath.h:1.5	Sun Dec 15 05:07:01 2002
+++ llvm/lib/Reoptimizer/BinInterface/bitmath.h	Thu Apr 10 00:33:56 2003
@@ -132,7 +132,9 @@
    return ((0xFFFFAA50 >> w) & 3)+n;   // this is a LUT
 }
 
-
+static unsigned LOW10(unsigned value)    { return value & 0x000003ff;       }
+static unsigned HIGH22(unsigned value)   { return value >> 10;              }
+static unsigned HIGHWORD(uint64_t value) { return (unsigned) (value >> 32); }
+static unsigned LOWWORD(uint64_t value)  { return (unsigned) value;         }
 
 #endif
-


Index: llvm/lib/Reoptimizer/BinInterface/sparc9.h
diff -u llvm/lib/Reoptimizer/BinInterface/sparc9.h:1.9 llvm/lib/Reoptimizer/BinInterface/sparc9.h:1.10
--- llvm/lib/Reoptimizer/BinInterface/sparc9.h:1.9	Tue Apr  1 16:13:35 2003
+++ llvm/lib/Reoptimizer/BinInterface/sparc9.h	Thu Apr 10 00:33:56 2003
@@ -395,5 +395,35 @@
    MK_FLD(INSTR_I, 1)             |            \
    MK_FLD(INSTR_OP3, OP3_ADD))
 
+// Many of these macros can generate 'integer overflow in expression' warnings in some
+// cases (e.g., passing a numeric literal for an immediate field), and the root cause has
+// not yet been determined. FIXME.
 
+// Construct immediate-valued logical operation
 
+#define MK_LOGIC_IMM(op3, dreg, sreg, imm) \
+ (MK_FLD(INSTR_OP, OP_2)    |              \
+  MK_FLD(INSTR_RD, dreg)    |              \
+  MK_FLD(INSTR_RS1, sreg)   |              \
+  MK_FLD(INSTR_SIMM13, imm) |              \
+  MK_FLD(INSTR_I, 1)        |              \
+  MK_FLD(INSTR_OP3, op3))
+
+// Construct sethi instruction
+
+#define MK_SETHI(dreg, imm)                \
+  (MK_FLD(INSTR_OP, OP_BRANCH)  |          \
+   MK_FLD(INSTR_RD, dreg)       |          \
+   MK_FLD(INSTR_OP2, OP2_SETHI) |          \
+   MK_FLD(INSTR_IMM22, imm))
+
+// Construct S{LL,RL,RA}X shift instruction. 
+
+#define MK_SHIFTX(op3, dreg, sreg, shcnt) \
+  (MK_FLD(INSTR_OP, OP_2)  |                \
+   MK_FLD(INSTR_RD, dreg)  |                \
+   MK_FLD(INSTR_OP3, op3)  |                \
+   MK_FLD(INSTR_RS1, sreg) |                \
+   MK_FLD(INSTR_I, 1)      |                \
+   MK_FLD(INSTR_X, 1)      |                \
+   MK_FLD(INSTR_SHCNT64, shcnt))





More information about the llvm-commits mailing list