Test expand intrinsics: npyv_expand_u16_u8 npyv_expand_u32_u16
(self)
| 1113 | assert false_vsfx != true_vsfx |
| 1114 | |
| 1115 | def test_conversion_expand(self): |
| 1116 | """ |
| 1117 | Test expand intrinsics: |
| 1118 | npyv_expand_u16_u8 |
| 1119 | npyv_expand_u32_u16 |
| 1120 | """ |
| 1121 | if self.sfx not in ("u8", "u16"): |
| 1122 | return |
| 1123 | totype = self.sfx[0]+str(int(self.sfx[1:])*2) |
| 1124 | expand = getattr(self.npyv, f"expand_{totype}_{self.sfx}") |
| 1125 | # close enough from the edge to detect any deviation |
| 1126 | data = self._data(self._int_max() - self.nlanes) |
| 1127 | vdata = self.load(data) |
| 1128 | edata = expand(vdata) |
| 1129 | # lower half part |
| 1130 | data_lo = data[:self.nlanes//2] |
| 1131 | # higher half part |
| 1132 | data_hi = data[self.nlanes//2:] |
| 1133 | assert edata == (data_lo, data_hi) |
| 1134 | |
| 1135 | def test_arithmetic_subadd(self): |
| 1136 | if self._is_fp(): |