Changeset 459 for proto/parabix2


Ignore:
Timestamp:
Jul 10, 2010, 12:25:01 PM (9 years ago)
Author:
cameron
Message:

carry_or defined, updates for MSVC

Location:
proto/parabix2/compiled
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/compiled/block_carry.h

    r457 r459  
    44    Licensed to International Characters Inc.
    55       under the Academic Free License version 3.0.
     6
     7This file defines addition, subtract and shift operations on
     8128-bit blocks.   Different versions of the operations are
     9selectable with the CARRY_STRATEGY preprocessor constant.
     10
     11Each implementation defines the following "abstract data type"
     12for block operations with carry.
     13
     14Typename:   CarryType
     15Constant:   Carry0  represents a value of 0 for the carry bit.
     16Predicate:  test_carry(x) returns nonzero if a carry bit is 1, 0 otherwise.
     17Function:   carry_or(carry1, carry2) forms the logical or of two carries.
     18Function:   adc128(x, y, carry, sum) computes (carry, sum) = x + y + carry,
     19Function:   advance_with_carry(cursor, carry, rslt)
     20                 computes (carry, rslt) = cursor + cursor + carry
     21Function:   sbb128(x, y, borrow, diff)
     22                 computes (borrow, diff) = y - x - borrow
     23
    624*/
    725#ifndef BLOCK_CARRY_H
    826#define BLOCK_CARRY_H
    927
     28
     29
     30
     31
    1032/*------------------------------------------------------------*/
    1133#include "sse_simd.h"
     
    2345
    2446#define test_carry(x) ((x) > 0)
     47
     48#define carry_or(carry1, carry2) (carry1 | carry2)
    2549
    2650#define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \
     
    7296         : "cc")
    7397
    74 #define sbb128(first, second, carry, sum) \
     98#define sbb128(first, second, borrow, diff) \
    7599do\
    76100{ union {__m128i bitblock;\
     
    87111\
    88112  double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \
    89                    rslt.int64[0], rslt.int64[1], carry);\
    90   sum = rslt.bitblock;\
     113                   rslt.int64[0], rslt.int64[1], borrow);\
     114  diff = rslt.bitblock;\
    91115}while(0)
    92116
     
    99123
    100124#define test_carry(x) (((x)&256) > 0)
     125
     126#define carry_or(carry1, carry2) (carry1 | carry2)
    101127
    102128#define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \
     
    147173         : "cc")
    148174
    149 #define sbb128(first, second, carry, sum) \
     175#define sbb128(first, second, borrow, diff) \
    150176do\
    151177{ union {__m128i bitblock;\
     
    162188\
    163189  double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \
    164                    rslt.int64[0], rslt.int64[1], carry);\
    165   sum = rslt.bitblock;\
     190                   rslt.int64[0], rslt.int64[1], borrow);\
     191  diff = rslt.bitblock;\
    166192}while(0)
    167193
     
    177203
    178204#define test_carry(x) bitblock_has_bit(x)
     205
     206#define carry_or(carry1, carry2) simd_or(carry1, carry2)
    179207
    180208#define adc128(x, y, carry,  sum) \
  • proto/parabix2/compiled/sse_simd.h

    r453 r459  
    1717#define BIG_ENDIAN 4321
    1818#define BYTE_ORDER LITTLE_ENDIAN
    19 #endif
     19#define inline __inline
     20#endif
     21
    2022#include <limits.h>
    2123#ifndef LONG_BIT
    22 #define LONG_BIT (8*__WORDSIZE)
    23 #endif
     24#if ULONG_MAX == 0xFFFFFFFF
     25#define LONG_BIT 32
     26#endif 
     27#if ULONG_MAX == 0xFFFFFFFFFFFFFFFF
     28#define LONG_BIT 64
     29#endif 
     30#endif
     31
    2432#include <emmintrin.h>
    2533#ifdef USE_LDDQU
     
    4452
    4553/*  Specific constants. */
    46 #define simd_himask_2 _mm_set1_epi8(0xAA)
    47 #define simd_himask_4 _mm_set1_epi8(0xCC)
    48 #define simd_himask_8 _mm_set1_epi8(0xF0)
     54#define simd_himask_2 _mm_set1_epi32(0xAAAAAAAA)
     55#define simd_himask_4 _mm_set1_epi32(0xCCCCCCCC)
     56#define simd_himask_8 _mm_set1_epi32(0xF0F0F0F0)
    4957/* Little-endian */
    50 #define simd_himask_16 _mm_set1_epi16(0xFF00)
     58#define simd_himask_16 _mm_set1_epi32(0xFF00FF00)
    5159#define simd_himask_32 _mm_set1_epi32(0xFFFF0000)
    5260#define simd_himask_64 _mm_set_epi32(-1,0,-1,0)
     
    134142#define simd_const_8(n) _mm_set1_epi8(n)
    135143#define simd_const_4(n) _mm_set1_epi8((n)<<4|(n))
    136 #define simd_const_2(n) simd_const_4(n<<2|n)
     144#define simd_const_2(n) simd_const_4((n)<<2|n)
    137145#define simd_const_1(n) \
    138146  (n==0 ? simd_const_8(0): simd_const_8(-1))
  • proto/parabix2/compiled/template.c

    r453 r459  
    145145        array_bit__0_,array_bit__1_,array_bit__2_,array_bit__3_,array_bit__4_,array_bit__5_,array_bit__6_,array_bit__7_);
    146146
    147         array_bit__0_ &= EOF_mask;
    148         array_bit__1_ &= EOF_mask;
    149         array_bit__2_ &= EOF_mask;
    150         array_bit__3_ &= EOF_mask;
    151         array_bit__4_ &= EOF_mask;
    152         array_bit__5_ &= EOF_mask;
    153         array_bit__6_ &= EOF_mask;
    154         array_bit__7_ &= EOF_mask;
     147        array_bit__0_ = simd_and(array_bit__0_, EOF_mask);
     148        array_bit__1_ = simd_and(array_bit__1_, EOF_mask);
     149        array_bit__2_ = simd_and(array_bit__2_, EOF_mask);
     150        array_bit__3_ = simd_and(array_bit__3_, EOF_mask);
     151        array_bit__4_ = simd_and(array_bit__4_, EOF_mask);
     152        array_bit__5_ = simd_and(array_bit__5_, EOF_mask);
     153        array_bit__6_ = simd_and(array_bit__6_, EOF_mask);
     154        array_bit__7_ = simd_and(array_bit__7_, EOF_mask);
    155155
    156156        @block_stmts
Note: See TracChangeset for help on using the changeset viewer.