[llvm-commits] CVS: llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h sparc9.h
John Criswell
criswell at choi.cs.uiuc.edu
Thu Jun 26 16:39:50 PDT 2003
Changes in directory llvm/include/llvm/Reoptimizer/BinInterface:
bitmath.h updated: 1.9 -> 1.9.2.1
sparc9.h updated: 1.14 -> 1.14.2.1
---
Log message:
Merged with mainline on Thursday, June 26, 2003.
Kept includes of "Config/assert.h" to avoid implicit dependencies on header
files.
---
Diffs of the changes:
Index: llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h
diff -u llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h:1.9 llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h:1.9.2.1
--- llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h:1.9 Sat May 31 17:16:41 2003
+++ llvm/include/llvm/Reoptimizer/BinInterface/bitmath.h Thu Jun 26 16:34:49 2003
@@ -16,6 +16,8 @@
#ifndef __BITMATH_H__
#define __BITMATH_H__
+#include "Support/DataTypes.h"
+
//*********************************
// Misc functions
//*********************************
@@ -29,9 +31,9 @@
//*********************************
#define FLD_UPPER(FLD_DEF) (1 ? FLD_DEF)
#define FLD_LOWER(FLD_DEF) (0 ? FLD_DEF)
-#define MASKBELOW(V) ((1 << V) - 1)
+#define MASKBELOW(V) ((((uint64_t) 1) << V) - 1) // 64-bit '1' constant here to avoid overflow warnings
#define MASKEQBELOW(V) ((1 << V) | MASKBELOW(V)) //masks off everything ABOVE
-#define RD_FLD(x, FLD) ((x & MASKEQBELOW(FLD_UPPER(FLD))) >> FLD_LOWER(FLD))
+#define RD_FLD(x, FLD) (unsigned)(((x & MASKEQBELOW(FLD_UPPER(FLD))) >> FLD_LOWER(FLD)))
#define MK_FLD(FLD, val) ((val << FLD_LOWER(FLD)) & MASKEQBELOW(FLD_UPPER(FLD)))
#define MASK_FLD(FLD) (MASKEQBELOW(FLD_UPPER(FLD)) & ~MASKBELOW(FLD_LOWER(FLD)))
#define RM_FLD(FLD, val) (val & ~(MASK_FLD(FLD)))
@@ -129,7 +131,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/include/llvm/Reoptimizer/BinInterface/sparc9.h
diff -u llvm/include/llvm/Reoptimizer/BinInterface/sparc9.h:1.14 llvm/include/llvm/Reoptimizer/BinInterface/sparc9.h:1.14.2.1
--- llvm/include/llvm/Reoptimizer/BinInterface/sparc9.h:1.14 Sat May 31 17:16:52 2003
+++ llvm/include/llvm/Reoptimizer/BinInterface/sparc9.h Thu Jun 26 16:34:49 2003
@@ -430,12 +430,111 @@
MK_FLD(INSTR_I, 1) | \
MK_FLD(INSTR_OP3, OP3_ADD))
-#define MK_INSTR_BRANCH_RS1(cond) \
+#define MK_INSTR_BRANCH_RS1(cond) \
(MK_FLD(INSTR_OP, OP_BRANCH) | \
MK_FLD(INSTR_BPR, BPR) | \
MK_FLD(INSTR_BPR_COND, cond))
#define MK_INSTR_BRANCH_NO_RS1(cond) \
(MK_FLD(INSTR_OP, OP_BRANCH) | \
- MK_FLD(INSTR_INT_BR, Bicc) | \
+ MK_FLD(INSTR_INT_BR, Bicc) | \
MK_FLD(INSTR_INTBR_COND, cond))
+
+// Add a register to a register
+
+#define MK_ADD_R_R(dreg, sreg1, sreg2) \
+ (MK_FLD(INSTR_OP, OP_2) | \
+ MK_FLD(INSTR_RD, dreg) | \
+ MK_FLD(INSTR_OP3, OP3_ADD) | \
+ MK_FLD(INSTR_RS1, sreg1) | \
+ MK_FLD(INSTR_I, 0) | \
+ MK_FLD(INSTR_RS2, sreg2))
+
+// 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 reg-to-reg logical operation
+
+#define MK_LOGIC(op3, dreg, sreg1, sreg2) \
+ (MK_FLD(INSTR_OP, OP_2) | \
+ MK_FLD(INSTR_RD, dreg) | \
+ MK_FLD(INSTR_RS1, sreg1) | \
+ MK_FLD(INSTR_RS2, sreg2) | \
+ MK_FLD(INSTR_I, 0) | \
+ 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))
+
+#define MK_STORE_IMM(srcreg, basereg, offset) \
+ (MK_FLD(INSTR_OP, OP_3) | \
+ MK_FLD(INSTR_RD, srcreg) | \
+ MK_FLD(INSTR_OP3, OP3_STX) | \
+ MK_FLD(INSTR_RS1, basereg) | \
+ MK_FLD(INSTR_I, 1) | \
+ MK_FLD(INSTR_SIMM13, offset))
+
+#define MK_LOAD_IMM(destreg, basereg, offset) \
+ (MK_FLD(INSTR_OP, OP_3) | \
+ MK_FLD(INSTR_RD, destreg) | \
+ MK_FLD(INSTR_OP3, OP3_LDX) | \
+ MK_FLD(INSTR_RS1, basereg) | \
+ MK_FLD(INSTR_I, 1) | \
+ MK_FLD(INSTR_SIMM13, offset))
+
+// Construct save instruction
+
+#define MK_SAVE_IMM(dreg, sreg, imm) \
+ (MK_FLD(INSTR_OP, OP_2) | \
+ MK_FLD(INSTR_RD, dreg) | \
+ MK_FLD(INSTR_OP3, OP3_SAVE) | \
+ MK_FLD(INSTR_RS1, sreg) | \
+ MK_FLD(INSTR_I, 1) | \
+ MK_FLD(INSTR_SIMM13, imm))
+
+#define MK_SAVE_REG(dreg, sreg1, sreg2) \
+ (MK_FLD(INSTR_OP, OP_2) | \
+ MK_FLD(INSTR_RD, dreg) | \
+ MK_FLD(INSTR_OP3, OP3_SAVE) | \
+ MK_FLD(INSTR_RS1, sreg1) | \
+ MK_FLD(INSTR_I, 0) | \
+ MK_FLD(INSTR_RS2, sreg2))
+
+#define MK_RESTORE_IMM(dreg, sreg, imm) \
+ (MK_FLD(INSTR_OP, OP_2) | \
+ MK_FLD(INSTR_RD, dreg) | \
+ MK_FLD(INSTR_OP3, OP3_RESTORE) | \
+ MK_FLD(INSTR_RS1, sreg) | \
+ MK_FLD(INSTR_I, 1) | \
+ MK_FLD(INSTR_SIMM13, imm))
+
+#define MK_JMPL_INDIRECT(dreg, sreg, imm) \
+ (MK_FLD(INSTR_OP, OP_2) | \
+ MK_FLD(INSTR_RD, dreg) | \
+ MK_FLD(INSTR_OP3, OP3_JMPL) | \
+ MK_FLD(INSTR_RS1, sreg) | \
+ MK_FLD(INSTR_I, 1) | \
+ MK_FLD(INSTR_SIMM13, imm))
More information about the llvm-commits
mailing list