condcodes.hh (4683:3b49d35562ed) | condcodes.hh (4715:2c37daa0ff2e) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 18 unchanged lines hidden (view full) --- 27 * 28 * Authors: Gabe Black 29 */ 30 31#ifndef __BASE_CONDCODE_HH__ 32#define __BASE_CONDCODE_HH__ 33 34#include "base/bitfield.hh" | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 18 unchanged lines hidden (view full) --- 27 * 28 * Authors: Gabe Black 29 */ 30 31#ifndef __BASE_CONDCODE_HH__ 32#define __BASE_CONDCODE_HH__ 33 34#include "base/bitfield.hh" |
35#include "base/trace.hh" |
|
35 36/** 37 * Calculate the carry flag from an addition. This should work even when 38 * a carry value is also added in. 39 */ 40inline 41bool 42findCarry(int width, uint64_t dest, uint64_t src1, uint64_t src2) { 43 int shift = width - 1; | 36 37/** 38 * Calculate the carry flag from an addition. This should work even when 39 * a carry value is also added in. 40 */ 41inline 42bool 43findCarry(int width, uint64_t dest, uint64_t src1, uint64_t src2) { 44 int shift = width - 1; |
44 return (~(dest >> shift) + (src1 >> shift) + (src2 >> shift)) & 0x2; | 45 return ((~(dest >> shift) & 1) + 46 ((src1 >> shift) & 1) + 47 ((src2 >> shift) & 1)) & 0x2; |
45} 46 47/** 48 * Calculate the overflow flag from an addition. 49 */ 50inline 51bool 52findOverflow(int width, uint64_t dest, uint64_t src1, uint64_t src2) { --- 39 unchanged lines hidden --- | 48} 49 50/** 51 * Calculate the overflow flag from an addition. 52 */ 53inline 54bool 55findOverflow(int width, uint64_t dest, uint64_t src1, uint64_t src2) { --- 39 unchanged lines hidden --- |