Changeset 1585 for trunk


Ignore:
Timestamp:
Oct 24, 2011, 1:56:18 PM (8 years ago)
Author:
huah
Message:

use load_type/store_type to define the idisa load/store operations so that generator could distinguish the load/store types for different architectures like m128i* in SSE2 and float const* in AVX

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/idisa_cpp/idisa_sse2.cpp

    r1584 r1585  
    8989public:
    9090        static IDISA_ALWAYS_INLINE bitblock128_t sll(bitblock128_t arg1, bitblock128_t arg2);
    91         static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(float const* arg1);
     91        static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(bitblock128_t* arg1);
    9292        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srli(bitblock128_t arg1);
    9393        static IDISA_ALWAYS_INLINE bitblock128_t srl(bitblock128_t arg1, bitblock128_t arg2);
    94         static IDISA_ALWAYS_INLINE void store_aligned(float* arg1, bitblock128_t arg2);
     94        static IDISA_ALWAYS_INLINE void store_aligned(bitblock128_t* arg1, bitblock128_t arg2);
    9595        static IDISA_ALWAYS_INLINE bool all(bitblock128_t arg1);
    9696        static IDISA_ALWAYS_INLINE bool any(bitblock128_t arg1);
    9797        static IDISA_ALWAYS_INLINE uint64_t popcount(bitblock128_t arg1);
    9898        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t slli(bitblock128_t arg1);
    99         static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(float const* arg1);
    100         static IDISA_ALWAYS_INLINE void store_unaligned(float* arg1, bitblock128_t arg2);
     99        static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(bitblock128_t* arg1);
     100        static IDISA_ALWAYS_INLINE void store_unaligned(bitblock128_t* arg1, bitblock128_t arg2);
    101101};
    102102
     
    29862986
    29872987//The total number of operations is 1
    2988 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(float const* arg1)
     2988IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(bitblock128_t* arg1)
    29892989{
    29902990        return _mm_loadu_si128((bitblock128_t*)(arg1));
     
    29982998
    29992999//The total number of operations is 1
    3000 IDISA_ALWAYS_INLINE void bitblock128::store_aligned(float* arg1, bitblock128_t arg2)
     3000IDISA_ALWAYS_INLINE void bitblock128::store_aligned(bitblock128_t* arg1, bitblock128_t arg2)
    30013001{
    30023002        _mm_store_si128((bitblock128_t*)(arg1), arg2);
     
    30343034
    30353035//The total number of operations is 1
    3036 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(float const* arg1)
     3036IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(bitblock128_t* arg1)
    30373037{
    30383038        return _mm_load_si128((bitblock128_t*)(arg1));
     
    30403040
    30413041//The total number of operations is 1
    3042 IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(float* arg1, bitblock128_t arg2)
     3042IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(bitblock128_t* arg1, bitblock128_t arg2)
    30433043{
    30443044        _mm_storeu_si128((bitblock128_t*)(arg1), arg2);
  • trunk/lib/idisa_cpp/idisa_sse3.cpp

    r1584 r1585  
    8989public:
    9090        static IDISA_ALWAYS_INLINE bitblock128_t sll(bitblock128_t arg1, bitblock128_t arg2);
    91         static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(float const* arg1);
     91        static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(bitblock128_t* arg1);
    9292        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srli(bitblock128_t arg1);
    9393        static IDISA_ALWAYS_INLINE bitblock128_t srl(bitblock128_t arg1, bitblock128_t arg2);
    94         static IDISA_ALWAYS_INLINE void store_aligned(float* arg1, bitblock128_t arg2);
     94        static IDISA_ALWAYS_INLINE void store_aligned(bitblock128_t* arg1, bitblock128_t arg2);
    9595        static IDISA_ALWAYS_INLINE bool all(bitblock128_t arg1);
    9696        static IDISA_ALWAYS_INLINE bool any(bitblock128_t arg1);
    9797        static IDISA_ALWAYS_INLINE uint64_t popcount(bitblock128_t arg1);
    9898        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t slli(bitblock128_t arg1);
    99         static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(float const* arg1);
    100         static IDISA_ALWAYS_INLINE void store_unaligned(float* arg1, bitblock128_t arg2);
     99        static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(bitblock128_t* arg1);
     100        static IDISA_ALWAYS_INLINE void store_unaligned(bitblock128_t* arg1, bitblock128_t arg2);
    101101};
    102102
     
    29862986
    29872987//The total number of operations is 1
    2988 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(float const* arg1)
     2988IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(bitblock128_t* arg1)
    29892989{
    29902990        return _mm_loadu_si128((bitblock128_t*)(arg1));
     
    29982998
    29992999//The total number of operations is 1
    3000 IDISA_ALWAYS_INLINE void bitblock128::store_aligned(float* arg1, bitblock128_t arg2)
     3000IDISA_ALWAYS_INLINE void bitblock128::store_aligned(bitblock128_t* arg1, bitblock128_t arg2)
    30013001{
    30023002        _mm_store_si128((bitblock128_t*)(arg1), arg2);
     
    30343034
    30353035//The total number of operations is 1
    3036 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(float const* arg1)
     3036IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(bitblock128_t* arg1)
    30373037{
    30383038        return _mm_load_si128((bitblock128_t*)(arg1));
     
    30403040
    30413041//The total number of operations is 1
    3042 IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(float* arg1, bitblock128_t arg2)
     3042IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(bitblock128_t* arg1, bitblock128_t arg2)
    30433043{
    30443044        _mm_storeu_si128((bitblock128_t*)(arg1), arg2);
  • trunk/lib/idisa_cpp/idisa_sse4_1.cpp

    r1584 r1585  
    9090public:
    9191        static IDISA_ALWAYS_INLINE bitblock128_t sll(bitblock128_t arg1, bitblock128_t arg2);
    92         static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(float const* arg1);
     92        static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(bitblock128_t* arg1);
    9393        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srli(bitblock128_t arg1);
    9494        static IDISA_ALWAYS_INLINE bitblock128_t srl(bitblock128_t arg1, bitblock128_t arg2);
    95         static IDISA_ALWAYS_INLINE void store_aligned(float* arg1, bitblock128_t arg2);
     95        static IDISA_ALWAYS_INLINE void store_aligned(bitblock128_t* arg1, bitblock128_t arg2);
    9696        static IDISA_ALWAYS_INLINE bool all(bitblock128_t arg1);
    9797        static IDISA_ALWAYS_INLINE bool any(bitblock128_t arg1);
    9898        static IDISA_ALWAYS_INLINE uint64_t popcount(bitblock128_t arg1);
    9999        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t slli(bitblock128_t arg1);
    100         static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(float const* arg1);
    101         static IDISA_ALWAYS_INLINE void store_unaligned(float* arg1, bitblock128_t arg2);
     100        static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(bitblock128_t* arg1);
     101        static IDISA_ALWAYS_INLINE void store_unaligned(bitblock128_t* arg1, bitblock128_t arg2);
    102102};
    103103
     
    30183018
    30193019//The total number of operations is 1
    3020 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(float const* arg1)
     3020IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(bitblock128_t* arg1)
    30213021{
    30223022        return _mm_loadu_si128((bitblock128_t*)(arg1));
     
    30303030
    30313031//The total number of operations is 1
    3032 IDISA_ALWAYS_INLINE void bitblock128::store_aligned(float* arg1, bitblock128_t arg2)
     3032IDISA_ALWAYS_INLINE void bitblock128::store_aligned(bitblock128_t* arg1, bitblock128_t arg2)
    30333033{
    30343034        _mm_store_si128((bitblock128_t*)(arg1), arg2);
     
    30663066
    30673067//The total number of operations is 1
    3068 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(float const* arg1)
     3068IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(bitblock128_t* arg1)
    30693069{
    30703070        return _mm_load_si128((bitblock128_t*)(arg1));
     
    30723072
    30733073//The total number of operations is 1
    3074 IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(float* arg1, bitblock128_t arg2)
     3074IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(bitblock128_t* arg1, bitblock128_t arg2)
    30753075{
    30763076        _mm_storeu_si128((bitblock128_t*)(arg1), arg2);
  • trunk/lib/idisa_cpp/idisa_sse4_2.cpp

    r1584 r1585  
    9090public:
    9191        static IDISA_ALWAYS_INLINE bitblock128_t sll(bitblock128_t arg1, bitblock128_t arg2);
    92         static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(float const* arg1);
     92        static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(bitblock128_t* arg1);
    9393        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srli(bitblock128_t arg1);
    9494        static IDISA_ALWAYS_INLINE bitblock128_t srl(bitblock128_t arg1, bitblock128_t arg2);
    95         static IDISA_ALWAYS_INLINE void store_aligned(float* arg1, bitblock128_t arg2);
     95        static IDISA_ALWAYS_INLINE void store_aligned(bitblock128_t* arg1, bitblock128_t arg2);
    9696        static IDISA_ALWAYS_INLINE bool all(bitblock128_t arg1);
    9797        static IDISA_ALWAYS_INLINE bool any(bitblock128_t arg1);
    9898        static IDISA_ALWAYS_INLINE uint64_t popcount(bitblock128_t arg1);
    9999        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t slli(bitblock128_t arg1);
    100         static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(float const* arg1);
    101         static IDISA_ALWAYS_INLINE void store_unaligned(float* arg1, bitblock128_t arg2);
     100        static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(bitblock128_t* arg1);
     101        static IDISA_ALWAYS_INLINE void store_unaligned(bitblock128_t* arg1, bitblock128_t arg2);
    102102};
    103103
     
    30003000
    30013001//The total number of operations is 1
    3002 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(float const* arg1)
     3002IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(bitblock128_t* arg1)
    30033003{
    30043004        return _mm_loadu_si128((bitblock128_t*)(arg1));
     
    30123012
    30133013//The total number of operations is 1
    3014 IDISA_ALWAYS_INLINE void bitblock128::store_aligned(float* arg1, bitblock128_t arg2)
     3014IDISA_ALWAYS_INLINE void bitblock128::store_aligned(bitblock128_t* arg1, bitblock128_t arg2)
    30153015{
    30163016        _mm_store_si128((bitblock128_t*)(arg1), arg2);
     
    30483048
    30493049//The total number of operations is 1
    3050 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(float const* arg1)
     3050IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(bitblock128_t* arg1)
    30513051{
    30523052        return _mm_load_si128((bitblock128_t*)(arg1));
     
    30543054
    30553055//The total number of operations is 1
    3056 IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(float* arg1, bitblock128_t arg2)
     3056IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(bitblock128_t* arg1, bitblock128_t arg2)
    30573057{
    30583058        _mm_storeu_si128((bitblock128_t*)(arg1), arg2);
  • trunk/lib/idisa_cpp/idisa_ssse3.cpp

    r1584 r1585  
    9090public:
    9191        static IDISA_ALWAYS_INLINE bitblock128_t sll(bitblock128_t arg1, bitblock128_t arg2);
    92         static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(float const* arg1);
     92        static IDISA_ALWAYS_INLINE bitblock128_t load_unaligned(bitblock128_t* arg1);
    9393        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t srli(bitblock128_t arg1);
    9494        static IDISA_ALWAYS_INLINE bitblock128_t srl(bitblock128_t arg1, bitblock128_t arg2);
    95         static IDISA_ALWAYS_INLINE void store_aligned(float* arg1, bitblock128_t arg2);
     95        static IDISA_ALWAYS_INLINE void store_aligned(bitblock128_t* arg1, bitblock128_t arg2);
    9696        static IDISA_ALWAYS_INLINE bool all(bitblock128_t arg1);
    9797        static IDISA_ALWAYS_INLINE bool any(bitblock128_t arg1);
    9898        static IDISA_ALWAYS_INLINE uint64_t popcount(bitblock128_t arg1);
    9999        template <uint64_t sh> static IDISA_ALWAYS_INLINE bitblock128_t slli(bitblock128_t arg1);
    100         static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(float const* arg1);
    101         static IDISA_ALWAYS_INLINE void store_unaligned(float* arg1, bitblock128_t arg2);
     100        static IDISA_ALWAYS_INLINE bitblock128_t load_aligned(bitblock128_t* arg1);
     101        static IDISA_ALWAYS_INLINE void store_unaligned(bitblock128_t* arg1, bitblock128_t arg2);
    102102};
    103103
     
    30213021
    30223022//The total number of operations is 1
    3023 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(float const* arg1)
     3023IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_unaligned(bitblock128_t* arg1)
    30243024{
    30253025        return _mm_loadu_si128((bitblock128_t*)(arg1));
     
    30333033
    30343034//The total number of operations is 1
    3035 IDISA_ALWAYS_INLINE void bitblock128::store_aligned(float* arg1, bitblock128_t arg2)
     3035IDISA_ALWAYS_INLINE void bitblock128::store_aligned(bitblock128_t* arg1, bitblock128_t arg2)
    30363036{
    30373037        _mm_store_si128((bitblock128_t*)(arg1), arg2);
     
    30693069
    30703070//The total number of operations is 1
    3071 IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(float const* arg1)
     3071IDISA_ALWAYS_INLINE bitblock128_t bitblock128::load_aligned(bitblock128_t* arg1)
    30723072{
    30733073        return _mm_load_si128((bitblock128_t*)(arg1));
     
    30753075
    30763076//The total number of operations is 1
    3077 IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(float* arg1, bitblock128_t arg2)
     3077IDISA_ALWAYS_INLINE void bitblock128::store_unaligned(bitblock128_t* arg1, bitblock128_t arg2)
    30783078{
    30793079        _mm_storeu_si128((bitblock128_t*)(arg1), arg2);
  • trunk/libgen/Configure/IDISAOperations.py

    r1584 r1585  
    533533    "bitblock_load_aligned":\
    534534    {
    535      "signature":"SIMD_type bitblock::load_aligned(float const* arg1)",
    536      "args_type":{"arg1":"float const*"},
     535     "signature":"SIMD_type bitblock::load_aligned(load_type arg1)",
     536     "args_type":{"arg1":"load_type"},
    537537     "return_type":"SIMD_type",
    538538    },
    539539    "bitblock_load_unaligned":\
    540540    {
    541      "signature":"SIMD_type bitblock::load_unaligned(float const* arg1)",
    542      "args_type":{"arg1":"float const*"},
     541     "signature":"SIMD_type bitblock::load_unaligned(load_type arg1)",
     542     "args_type":{"arg1":"load_type"},
    543543     "return_type":"SIMD_type",
    544544    },
     
    546546    "bitblock_store_aligned":\
    547547    {
    548      "signature":"void bitblock::store_aligned(float* arg1, SIMD_type arg2)",
    549      "args_type":{"arg1":"float*", "arg2":"SIMD_type"},
     548     "signature":"void bitblock::store_aligned(store_type arg1, SIMD_type arg2)",
     549     "args_type":{"arg1":"store_type", "arg2":"SIMD_type"},
    550550     "return_type":"void",
    551551    },
    552552    "bitblock_store_unaligned":\
    553553    {
    554      "signature":"void bitblock::store_unaligned(float* arg1, SIMD_type arg2)",
    555      "args_type":{"arg1":"float*", "arg2":"SIMD_type"},
     554     "signature":"void bitblock::store_unaligned(store_type arg1, SIMD_type arg2)",
     555     "args_type":{"arg1":"store_type", "arg2":"SIMD_type"},
    556556     "return_type":"void",
    557557    },
  • trunk/libgen/Configure/configure.py

    r1548 r1585  
    115115                                AVX:"bitblock256_t"}
    116116
     117Load_type = {MMX:"bitblock64_t*", SSE:"bitblock128_t*", SSE2:"bitblock128_t*", SSE3:"bitblock128_t*", SSSE3:"bitblock128_t*", SSE4_1:"bitblock128_t*", SSE4_2:"bitblock128_t*",
     118                        AVX:"float const*"}
     119
     120Store_type = {MMX:"bitblock64_t*", SSE:"bitblock128_t*", SSE2:"bitblock128_t*", SSE3:"bitblock128_t*", SSSE3:"bitblock128_t*", SSE4_1:"bitblock128_t*", SSE4_2:"bitblock128_t*",
     121                        AVX:"float*"}
     122
    117123AVXBuiltInVecWrapper = "AVXBuiltInVecWrapper"
    118124AVXBuiltInHorWrapper = "AVXBuiltInHorWrapper"
  • trunk/libgen/Library_Generator/Operation.py

    r1584 r1585  
    103103                        elif StandardTypes.IsFloatPointer(argType):
    104104                                argType = StandardTypes.GetFloatPointer()
     105                        elif StandardTypes.IsLoadType(argType):
     106                                argType = StandardTypes.GetLoadType(self.arch)
     107                        elif StandardTypes.IsStoreType(argType):
     108                                argType = StandardTypes.GetStoreType(self.arch)
    105109                        else:
    106110                                #it must be a SIMD_type
  • trunk/libgen/Library_Generator/StandardTypes.py

    r1584 r1585  
    6262    return "float*"
    6363
     64def GetLoadType(arch):
     65    return configure.Load_type[arch]
     66
     67def GetStoreType(arch):
     68    return configure.Store_type[arch]
     69
     70def IsLoadType(typeStr):
     71    return "load_type" == typeStr
     72
     73def IsStoreType(typeStr):
     74    return "store_type" == typeStr
     75
    6476def Is64BitFloatingType(typeStr):
    6577    return "__m256d" in typeStr
Note: See TracChangeset for help on using the changeset viewer.