From 7a0092754d7df0274dfae1deb915fe3dd5149ff6 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Wed, 29 Mar 2017 15:13:19 -0700 Subject: [PATCH] Allow vector types for isplit and iconcat. These two instructions make sense for vector types by simply performing the same operation on each lane, like most other vector operations. Problem found by @angusholder's verifier. --- lib/cretonne/meta/base/instructions.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/cretonne/meta/base/instructions.py b/lib/cretonne/meta/base/instructions.py index ade9b540bd..541889f7d5 100644 --- a/lib/cretonne/meta/base/instructions.py +++ b/lib/cretonne/meta/base/instructions.py @@ -1278,8 +1278,8 @@ fcvt_from_sint = Instruction( # WideInt = TypeVar( - 'WideInt', 'A scalar integer type from `i16` upwards', - ints=(16, 64)) + 'WideInt', 'An integer type with lanes from `i16` upwards', + ints=(16, 64), simd=True) x = Operand('x', WideInt) lo = Operand( 'lo', WideInt.half_width(), 'The low bits of `x`') @@ -1288,7 +1288,10 @@ hi = Operand( isplit = Instruction( 'isplit', r""" - Split a scalar integer into low and high parts. + Split an integer into low and high parts. + + Vectors of integers are split lane-wise, so the results have the same + number of lanes as the input, but the lanes are half the size. Returns the low half of `x` and the high half of `x` as two independent values. @@ -1297,8 +1300,8 @@ isplit = Instruction( NarrowInt = TypeVar( - 'NarrowInt', 'A scalar integer type up to `i32`', - ints=(8, 32)) + 'NarrowInt', 'An integer type with lanes type to `i32`', + ints=(8, 32), simd=True) lo = Operand('lo', NarrowInt) hi = Operand('hi', NarrowInt) a = Operand( @@ -1308,6 +1311,10 @@ a = Operand( iconcat = Instruction( 'iconcat', r""" Concatenate low and high bits to form a larger integer type. + + Vectors of integers are concatenated lane-wise such that the result has + the same number of lanes as the inputs, but the lanes are twice the + size. """, ins=(lo, hi), outs=a)