summaryrefslogtreecommitdiff
path: root/src/cuda-sim/instructions.cc
diff options
context:
space:
mode:
authorAndrew M. B. Boktor <[email protected]>2012-07-10 23:00:30 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:47:33 -0700
commitdc45f0ec4b16144c248fb86acc905fbb5b627300 (patch)
tree9a67669f23b30b79602c94c43190fdd7435aa74a /src/cuda-sim/instructions.cc
parent6f99ffb9b171495df7ef0725f8a8cbffb8d9591c (diff)
Fix for bug #154-internal and #8-external
Adding support for double destination to mad instruction Fixing broken madp instruction Adding a patch to cuobjdump_to_ptxplus to work around the C3 problem (Documented in bug #154 internal). [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 13349]
Diffstat (limited to 'src/cuda-sim/instructions.cc')
-rw-r--r--src/cuda-sim/instructions.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index def0c55..37e5d00 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -2261,6 +2261,9 @@ void mad_def( const ptx_instruction *pI, ptx_thread_info *thread, bool use_carry
const operand_info &src3 = pI->src3();
ptx_reg_t d, t;
+ int carry=0;
+ int overflow=0;
+
unsigned i_type = pI->get_type();
ptx_reg_t a = thread->get_operand_value(src1, dst, i_type, thread, 1);
ptx_reg_t b = thread->get_operand_value(src2, dst, i_type, thread, 1);
@@ -2272,7 +2275,8 @@ void mad_def( const ptx_instruction *pI, ptx_thread_info *thread, bool use_carry
if (use_carry) {
const operand_info &carry = pI->operand_lookup(4);
carry_bit = thread->get_operand_value(carry, dst, PRED_TYPE, thread, 0);
- carry_bit.pred &= 0x4;
+ carry_bit.pred &= 0x4;
+ carry_bit.pred >>=2;
}
unsigned rounding_mode = pI->rounding_mode();
@@ -2284,6 +2288,7 @@ void mad_def( const ptx_instruction *pI, ptx_thread_info *thread, bool use_carry
else if ( pI->is_hi() ) d.s16 = (t.s32>>16) + c.s16 + carry_bit.pred;
else if ( pI->is_lo() ) d.s16 = t.s16 + c.s16 + carry_bit.pred;
else assert(0);
+ carry = ((long long int)(t.s32 + c.s32 + carry_bit.pred)&0x100000000)>>32;
break;
case S32_TYPE:
t.s64 = a.s32 * b.s32;
@@ -2306,6 +2311,7 @@ void mad_def( const ptx_instruction *pI, ptx_thread_info *thread, bool use_carry
else if ( pI->is_hi() ) d.u16 = (t.u32 + c.u16 + carry_bit.pred)>>16;
else if ( pI->is_lo() ) d.u16 = t.u16 + c.u16 + carry_bit.pred;
else assert(0);
+ carry = ((long long int)((long long int)t.u32 + c.u32 + carry_bit.pred)&0x100000000)>>32;
break;
case U32_TYPE:
t.u64 = a.u32 * b.u32;
@@ -2361,7 +2367,7 @@ void mad_def( const ptx_instruction *pI, ptx_thread_info *thread, bool use_carry
assert(0);
break;
}
- thread->set_operand_value(dst, d, i_type, thread, pI);
+ thread->set_operand_value(dst, d, i_type, thread, pI, overflow, carry);
}
bool isNaN(float x)