Ignore:
Timestamp:
Nov 6, 2014, 6:24:05 PM (5 years ago)
Author:
linmengl
Message:

add tests for long shift right and dslli

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib_ir/gen/test_llc.pytemplate.cpp

    r4278 r4296  
    3636{% for sh in LongShiftAmount128 %}
    3737SIMD_type long_shift_left_{{sh}}(SIMD_type a);
     38SIMD_type long_shift_right_{{sh}}(SIMD_type a);
     39SIMD_type long_shift_dslli_{{sh}}(SIMD_type a, SIMD_type b);
    3840{% endfor %}
    3941}
     
    139141}
    140142
    141 int test_long_shift(const SIMD_type &a)
     143int test_long_shift(const SIMD_type &a, const SIMD_type &b)
    142144{
    143   SIMD_type b, c, d;
     145  SIMD_type c, d;
    144146  {% for sh in LongShiftAmount128 %}
    145   b = simd<128>::slli<{{sh}}>(a);
     147  d = simd<128>::slli<{{sh}}>(a);
    146148  c = long_shift_left_{{sh}}(a);
    147   if (to_string(b) != to_string(c)) {
     149  if (to_string(d) != to_string(c)) {
    148150    cout << "long_shift_left with sh = {{sh}} failed." << endl;
    149151    return 1;
    150152  }
    151153
     154  d = simd<128>::srli<{{sh}}>(a);
     155  c = long_shift_right_{{sh}}(a);
     156  if (to_string(d) != to_string(c)) {
     157    cout << "long_shift_right with sh = {{sh}} failed." << endl;
     158    return 1;
     159  }
     160
     161  c = long_shift_dslli_{{sh}}(a, b);
     162  d = simd_or( simd<128>::slli<{{sh}}>(a), simd<128>::srli<{{128 - sh}}>(b) );
     163  if (to_string(c) != to_string(d)) {
     164    cout << "long_shift_dslli with sh = {{sh}} failed." << endl;
     165    return 1;
     166  }
    152167  {% endfor %}
    153168
     
    237252      return 1;
    238253
    239     if (test_long_shift(a))
     254    if (test_long_shift(a, b))
    240255      return 1;
    241256  }
Note: See TracChangeset for help on using the changeset viewer.