|
19 | 19 | SPEC = re.compile(
|
20 | 20 | r'^(?:(?P<void>V)|(?P<id>[iusfIUSF])(?:\((?P<start>\d+)-(?P<end>\d+)\)|'
|
21 | 21 | r'(?P<width>\d+)(:?/(?P<llvm_width>\d+))?)'
|
22 |
| - r'|(?P<reference>\d+))(?P<index>\.\d+)?(?P<modifiers>[vShdnwusfDMC]*)(?P<force_width>x\d+)?' |
| 22 | + r'|(?P<reference>\d+))(?P<index>\.\d+)?(?P<modifiers>[vShdnwusfDMCNW]*)(?P<force_width>x\d+)?' |
23 | 23 | r'(?:(?P<pointer>Pm|Pc)(?P<llvm_pointer>/.*)?|(?P<bitcast>->.*))?$'
|
24 | 24 | )
|
25 | 25 |
|
@@ -246,6 +246,12 @@ def modify(self, spec, width, previous):
|
246 | 246 | return Vector(self._elem, self._length // 2)
|
247 | 247 | elif spec == 'd':
|
248 | 248 | return Vector(self._elem, self._length * 2)
|
| 249 | + elif spec == 'N': |
| 250 | + elem = self._elem.__class__(self._elem.bitwidth() // 2) |
| 251 | + return Vector(elem, self._length * 2) |
| 252 | + elif spec == 'W': |
| 253 | + elem = self._elem.__class__(self._elem.bitwidth() * 2) |
| 254 | + return Vector(elem, self._length // 2) |
249 | 255 | elif spec.startswith('x'):
|
250 | 256 | new_bitwidth = int(spec[1:])
|
251 | 257 | return Vector(self._elem, new_bitwidth // self._elem.bitwidth())
|
@@ -714,6 +720,8 @@ def parse_args():
|
714 | 720 | - 'd': double the length of the vector (u32x2 -> u32x4)
|
715 | 721 | - 'n': narrow the element of the vector (u32x4 -> u16x4)
|
716 | 722 | - 'w': widen the element of the vector (u16x4 -> u32x4)
|
| 723 | + - 'N': half the length of the vector element (u32x4 -> u16x8) |
| 724 | + - 'W': double the length of the vector element (u16x8 -> u32x4) |
717 | 725 | - 'u': force a number (vector or scalar) to be unsigned int (f32x4 -> u32x4)
|
718 | 726 | - 's': force a number (vector or scalar) to be signed int (u32x4 -> i32x4)
|
719 | 727 | - 'f': force a number (vector or scalar) to be float (u32x4 -> f32x4)
|
|
0 commit comments