Test I32x4 swizzles

This commit is contained in:
luisbg 2019-05-28 16:48:04 -04:00 committed by Luis de Bethencourt
parent b887690b73
commit 16813b9ebe
1 changed files with 258 additions and 2 deletions

View File

@ -389,8 +389,264 @@ fn test_i32x4_packed_comparisons() {
#[test]
fn test_i32x4_swizzles() {
let a = I32x4::new(1, 2, 3, 4);
assert_eq!(a.xxxx(), I32x4::splat(1));
assert_eq!(a.yyyy(), I32x4::splat(2));
assert_eq!(a.zzzz(), I32x4::splat(3));
assert_eq!(a.wwww(), I32x4::splat(4));
assert_eq!(a.yxxx(), I32x4::new(2, 1, 1, 1));
assert_eq!(a.zxxx(), I32x4::new(3, 1, 1, 1));
assert_eq!(a.wxxx(), I32x4::new(4, 1, 1, 1));
assert_eq!(a.xyxx(), I32x4::new(1, 2, 1, 1));
assert_eq!(a.yyxx(), I32x4::new(2, 2, 1, 1));
assert_eq!(a.zyxx(), I32x4::new(3, 2, 1, 1));
assert_eq!(a.wyxx(), I32x4::new(4, 2, 1, 1));
assert_eq!(a.xzxx(), I32x4::new(1, 3, 1, 1));
assert_eq!(a.yzxx(), I32x4::new(2, 3, 1, 1));
assert_eq!(a.zzxx(), I32x4::new(3, 3, 1, 1));
assert_eq!(a.wzxx(), I32x4::new(4, 3, 1, 1));
assert_eq!(a.xwxx(), I32x4::new(1, 4, 1, 1));
assert_eq!(a.ywxx(), I32x4::new(2, 4, 1, 1));
assert_eq!(a.zwxx(), I32x4::new(3, 4, 1, 1));
assert_eq!(a.wwxx(), I32x4::new(4, 4, 1, 1));
assert_eq!(a.xxyx(), I32x4::new(1, 1, 2, 1));
assert_eq!(a.yxyx(), I32x4::new(2, 1, 2, 1));
assert_eq!(a.zxyx(), I32x4::new(3, 1, 2, 1));
assert_eq!(a.wxyx(), I32x4::new(4, 1, 2, 1));
assert_eq!(a.xyyx(), I32x4::new(1, 2, 2, 1));
assert_eq!(a.yyyx(), I32x4::new(2, 2, 2, 1));
assert_eq!(a.zyyx(), I32x4::new(3, 2, 2, 1));
assert_eq!(a.wyyx(), I32x4::new(4, 2, 2, 1));
assert_eq!(a.xzyx(), I32x4::new(1, 3, 2, 1));
assert_eq!(a.yzyx(), I32x4::new(2, 3, 2, 1));
assert_eq!(a.zzyx(), I32x4::new(3, 3, 2, 1));
assert_eq!(a.wzyx(), I32x4::new(4, 3, 2, 1));
assert_eq!(a.xwyx(), I32x4::new(1, 4, 2, 1));
assert_eq!(a.ywyx(), I32x4::new(2, 4, 2, 1));
assert_eq!(a.zwyx(), I32x4::new(3, 4, 2, 1));
assert_eq!(a.wwyx(), I32x4::new(4, 4, 2, 1));
assert_eq!(a.xxzx(), I32x4::new(1, 1, 3, 1));
assert_eq!(a.yxzx(), I32x4::new(2, 1, 3, 1));
assert_eq!(a.zxzx(), I32x4::new(3, 1, 3, 1));
assert_eq!(a.wxzx(), I32x4::new(4, 1, 3, 1));
assert_eq!(a.xyzx(), I32x4::new(1, 2, 3, 1));
assert_eq!(a.yyzx(), I32x4::new(2, 2, 3, 1));
assert_eq!(a.zyzx(), I32x4::new(3, 2, 3, 1));
assert_eq!(a.wyzx(), I32x4::new(4, 2, 3, 1));
assert_eq!(a.xzzx(), I32x4::new(1, 3, 3, 1));
assert_eq!(a.yzzx(), I32x4::new(2, 3, 3, 1));
assert_eq!(a.zzzx(), I32x4::new(3, 3, 3, 1));
assert_eq!(a.wzzx(), I32x4::new(4, 3, 3, 1));
assert_eq!(a.xwzx(), I32x4::new(1, 4, 3, 1));
assert_eq!(a.ywzx(), I32x4::new(2, 4, 3, 1));
assert_eq!(a.zwzx(), I32x4::new(3, 4, 3, 1));
assert_eq!(a.wwzx(), I32x4::new(4, 4, 3, 1));
assert_eq!(a.xxwx(), I32x4::new(1, 1, 4, 1));
assert_eq!(a.yxwx(), I32x4::new(2, 1, 4, 1));
assert_eq!(a.zxwx(), I32x4::new(3, 1, 4, 1));
assert_eq!(a.wxwx(), I32x4::new(4, 1, 4, 1));
assert_eq!(a.xywx(), I32x4::new(1, 2, 4, 1));
assert_eq!(a.yywx(), I32x4::new(2, 2, 4, 1));
assert_eq!(a.zywx(), I32x4::new(3, 2, 4, 1));
assert_eq!(a.wywx(), I32x4::new(4, 2, 4, 1));
assert_eq!(a.xzwx(), I32x4::new(1, 3, 4, 1));
assert_eq!(a.yzwx(), I32x4::new(2, 3, 4, 1));
assert_eq!(a.zzwx(), I32x4::new(3, 3, 4, 1));
assert_eq!(a.wzwx(), I32x4::new(4, 3, 4, 1));
assert_eq!(a.xwwx(), I32x4::new(1, 4, 4, 1));
assert_eq!(a.ywwx(), I32x4::new(2, 4, 4, 1));
assert_eq!(a.zwwx(), I32x4::new(3, 4, 4, 1));
assert_eq!(a.wwwx(), I32x4::new(4, 4, 4, 1));
assert_eq!(a.xxxy(), I32x4::new(1, 1, 1, 2));
assert_eq!(a.yxxy(), I32x4::new(2, 1, 1, 2));
assert_eq!(a.zxxy(), I32x4::new(3, 1, 1, 2));
assert_eq!(a.wxxy(), I32x4::new(4, 1, 1, 2));
assert_eq!(a.xyxy(), I32x4::new(1, 2, 1, 2));
assert_eq!(a.xwzy(), I32x4::new(1, 4, 3, 2));
assert_eq!(a.zyxw(), I32x4::new(3, 2, 1, 4));
assert_eq!(a.yyxy(), I32x4::new(2, 2, 1, 2));
assert_eq!(a.zyxy(), I32x4::new(3, 2, 1, 2));
assert_eq!(a.wyxy(), I32x4::new(4, 2, 1, 2));
assert_eq!(a.xzxy(), I32x4::new(1, 3, 1, 2));
assert_eq!(a.yzxy(), I32x4::new(2, 3, 1, 2));
assert_eq!(a.zzxy(), I32x4::new(3, 3, 1, 2));
assert_eq!(a.wzxy(), I32x4::new(4, 3, 1, 2));
assert_eq!(a.xwxy(), I32x4::new(1, 4, 1, 2));
assert_eq!(a.ywxy(), I32x4::new(2, 4, 1, 2));
assert_eq!(a.zwxy(), I32x4::new(3, 4, 1, 2));
assert_eq!(a.wwxy(), I32x4::new(4, 4, 1, 2));
assert_eq!(a.xxyy(), I32x4::new(1, 1, 2, 2));
assert_eq!(a.yxyy(), I32x4::new(2, 1, 2, 2));
assert_eq!(a.zxyy(), I32x4::new(3, 1, 2, 2));
assert_eq!(a.wxyy(), I32x4::new(4, 1, 2, 2));
assert_eq!(a.xyyy(), I32x4::new(1, 2, 2, 2));
assert_eq!(a.zyyy(), I32x4::new(3, 2, 2, 2));
assert_eq!(a.wyyy(), I32x4::new(4, 2, 2, 2));
assert_eq!(a.xzyy(), I32x4::new(1, 3, 2, 2));
assert_eq!(a.yzyy(), I32x4::new(2, 3, 2, 2));
assert_eq!(a.zzyy(), I32x4::new(3, 3, 2, 2));
assert_eq!(a.wzyy(), I32x4::new(4, 3, 2, 2));
assert_eq!(a.xwyy(), I32x4::new(1, 4, 2, 2));
assert_eq!(a.ywyy(), I32x4::new(2, 4, 2, 2));
assert_eq!(a.zwyy(), I32x4::new(3, 4, 2, 2));
assert_eq!(a.wwyy(), I32x4::new(4, 4, 2, 2));
assert_eq!(a.xxzy(), I32x4::new(1, 1, 3, 2));
assert_eq!(a.yxzy(), I32x4::new(2, 1, 3, 2));
assert_eq!(a.zxzy(), I32x4::new(3, 1, 3, 2));
assert_eq!(a.wxzy(), I32x4::new(4, 1, 3, 2));
assert_eq!(a.xyzy(), I32x4::new(1, 2, 3, 2));
assert_eq!(a.yyzy(), I32x4::new(2, 2, 3, 2));
assert_eq!(a.zyzy(), I32x4::new(3, 2, 3, 2));
assert_eq!(a.wyzy(), I32x4::new(4, 2, 3, 2));
assert_eq!(a.xzzy(), I32x4::new(1, 3, 3, 2));
assert_eq!(a.yzzy(), I32x4::new(2, 3, 3, 2));
assert_eq!(a.zzzy(), I32x4::new(3, 3, 3, 2));
assert_eq!(a.wzzy(), I32x4::new(4, 3, 3, 2));
assert_eq!(a.xwzy(), I32x4::new(1, 4, 3, 2));
assert_eq!(a.ywzy(), I32x4::new(2, 4, 3, 2));
assert_eq!(a.zwzy(), I32x4::new(3, 4, 3, 2));
assert_eq!(a.wwzy(), I32x4::new(4, 4, 3, 2));
assert_eq!(a.xxwy(), I32x4::new(1, 1, 4, 2));
assert_eq!(a.yxwy(), I32x4::new(2, 1, 4, 2));
assert_eq!(a.zxwy(), I32x4::new(3, 1, 4, 2));
assert_eq!(a.wxwy(), I32x4::new(4, 1, 4, 2));
assert_eq!(a.xywy(), I32x4::new(1, 2, 4, 2));
assert_eq!(a.yywy(), I32x4::new(2, 2, 4, 2));
assert_eq!(a.zywy(), I32x4::new(3, 2, 4, 2));
assert_eq!(a.wywy(), I32x4::new(4, 2, 4, 2));
assert_eq!(a.xzwy(), I32x4::new(1, 3, 4, 2));
assert_eq!(a.yzwy(), I32x4::new(2, 3, 4, 2));
assert_eq!(a.zzwy(), I32x4::new(3, 3, 4, 2));
assert_eq!(a.wzwy(), I32x4::new(4, 3, 4, 2));
assert_eq!(a.xwwy(), I32x4::new(1, 4, 4, 2));
assert_eq!(a.ywwy(), I32x4::new(2, 4, 4, 2));
assert_eq!(a.zwwy(), I32x4::new(3, 4, 4, 2));
assert_eq!(a.wwwy(), I32x4::new(4, 4, 4, 2));
assert_eq!(a.xxxz(), I32x4::new(1, 1, 1, 3));
assert_eq!(a.yxxz(), I32x4::new(2, 1, 1, 3));
assert_eq!(a.zxxz(), I32x4::new(3, 1, 1, 3));
assert_eq!(a.wxxz(), I32x4::new(4, 1, 1, 3));
assert_eq!(a.xyxz(), I32x4::new(1, 2, 1, 3));
assert_eq!(a.yyxz(), I32x4::new(2, 2, 1, 3));
assert_eq!(a.zyxz(), I32x4::new(3, 2, 1, 3));
assert_eq!(a.wyxz(), I32x4::new(4, 2, 1, 3));
assert_eq!(a.xzxz(), I32x4::new(1, 3, 1, 3));
assert_eq!(a.yzxz(), I32x4::new(2, 3, 1, 3));
assert_eq!(a.zzxz(), I32x4::new(3, 3, 1, 3));
assert_eq!(a.wzxz(), I32x4::new(4, 3, 1, 3));
assert_eq!(a.xwxz(), I32x4::new(1, 4, 1, 3));
assert_eq!(a.ywxz(), I32x4::new(2, 4, 1, 3));
assert_eq!(a.zwxz(), I32x4::new(3, 4, 1, 3));
assert_eq!(a.wwxz(), I32x4::new(4, 4, 1, 3));
assert_eq!(a.xxyz(), I32x4::new(1, 1, 2, 3));
assert_eq!(a.yxyz(), I32x4::new(2, 1, 2, 3));
assert_eq!(a.zxyz(), I32x4::new(3, 1, 2, 3));
assert_eq!(a.wxyz(), I32x4::new(4, 1, 2, 3));
assert_eq!(a.xyyz(), I32x4::new(1, 2, 2, 3));
assert_eq!(a.yyyz(), I32x4::new(2, 2, 2, 3));
assert_eq!(a.zyyz(), I32x4::new(3, 2, 2, 3));
assert_eq!(a.wyyz(), I32x4::new(4, 2, 2, 3));
assert_eq!(a.xzyz(), I32x4::new(1, 3, 2, 3));
assert_eq!(a.yzyz(), I32x4::new(2, 3, 2, 3));
assert_eq!(a.zzyz(), I32x4::new(3, 3, 2, 3));
assert_eq!(a.wzyz(), I32x4::new(4, 3, 2, 3));
assert_eq!(a.xwyz(), I32x4::new(1, 4, 2, 3));
assert_eq!(a.ywyz(), I32x4::new(2, 4, 2, 3));
assert_eq!(a.zwyz(), I32x4::new(3, 4, 2, 3));
assert_eq!(a.wwyz(), I32x4::new(4, 4, 2, 3));
assert_eq!(a.xxzz(), I32x4::new(1, 1, 3, 3));
assert_eq!(a.yxzz(), I32x4::new(2, 1, 3, 3));
assert_eq!(a.zxzz(), I32x4::new(3, 1, 3, 3));
assert_eq!(a.wxzz(), I32x4::new(4, 1, 3, 3));
assert_eq!(a.xyzz(), I32x4::new(1, 2, 3, 3));
assert_eq!(a.yyzz(), I32x4::new(2, 2, 3, 3));
assert_eq!(a.zyzz(), I32x4::new(3, 2, 3, 3));
assert_eq!(a.wyzz(), I32x4::new(4, 2, 3, 3));
assert_eq!(a.xzzz(), I32x4::new(1, 3, 3, 3));
assert_eq!(a.yzzz(), I32x4::new(2, 3, 3, 3));
assert_eq!(a.wzzz(), I32x4::new(4, 3, 3, 3));
assert_eq!(a.xwzz(), I32x4::new(1, 4, 3, 3));
assert_eq!(a.ywzz(), I32x4::new(2, 4, 3, 3));
assert_eq!(a.zwzz(), I32x4::new(3, 4, 3, 3));
assert_eq!(a.wwzz(), I32x4::new(4, 4, 3, 3));
assert_eq!(a.xxwz(), I32x4::new(1, 1, 4, 3));
assert_eq!(a.yxwz(), I32x4::new(2, 1, 4, 3));
assert_eq!(a.zxwz(), I32x4::new(3, 1, 4, 3));
assert_eq!(a.wxwz(), I32x4::new(4, 1, 4, 3));
assert_eq!(a.xywz(), I32x4::new(1, 2, 4, 3));
assert_eq!(a.yywz(), I32x4::new(2, 2, 4, 3));
assert_eq!(a.zywz(), I32x4::new(3, 2, 4, 3));
assert_eq!(a.wywz(), I32x4::new(4, 2, 4, 3));
assert_eq!(a.xzwz(), I32x4::new(1, 3, 4, 3));
assert_eq!(a.yzwz(), I32x4::new(2, 3, 4, 3));
assert_eq!(a.zzwz(), I32x4::new(3, 3, 4, 3));
assert_eq!(a.wzwz(), I32x4::new(4, 3, 4, 3));
assert_eq!(a.xwwz(), I32x4::new(1, 4, 4, 3));
assert_eq!(a.ywwz(), I32x4::new(2, 4, 4, 3));
assert_eq!(a.zwwz(), I32x4::new(3, 4, 4, 3));
assert_eq!(a.wwwz(), I32x4::new(4, 4, 4, 3));
assert_eq!(a.xxxw(), I32x4::new(1, 1, 1, 4));
assert_eq!(a.yxxw(), I32x4::new(2, 1, 1, 4));
assert_eq!(a.zxxw(), I32x4::new(3, 1, 1, 4));
assert_eq!(a.wxxw(), I32x4::new(4, 1, 1, 4));
assert_eq!(a.xyxw(), I32x4::new(1, 2, 1, 4));
assert_eq!(a.yyxw(), I32x4::new(2, 2, 1, 4));
assert_eq!(a.zyxw(), I32x4::new(3, 2, 1, 4));
assert_eq!(a.wyxw(), I32x4::new(4, 2, 1, 4));
assert_eq!(a.xzxw(), I32x4::new(1, 3, 1, 4));
assert_eq!(a.yzxw(), I32x4::new(2, 3, 1, 4));
assert_eq!(a.zzxw(), I32x4::new(3, 3, 1, 4));
assert_eq!(a.wzxw(), I32x4::new(4, 3, 1, 4));
assert_eq!(a.xwxw(), I32x4::new(1, 4, 1, 4));
assert_eq!(a.ywxw(), I32x4::new(2, 4, 1, 4));
assert_eq!(a.zwxw(), I32x4::new(3, 4, 1, 4));
assert_eq!(a.wwxw(), I32x4::new(4, 4, 1, 4));
assert_eq!(a.xxyw(), I32x4::new(1, 1, 2, 4));
assert_eq!(a.yxyw(), I32x4::new(2, 1, 2, 4));
assert_eq!(a.zxyw(), I32x4::new(3, 1, 2, 4));
assert_eq!(a.wxyw(), I32x4::new(4, 1, 2, 4));
assert_eq!(a.xyyw(), I32x4::new(1, 2, 2, 4));
assert_eq!(a.yyyw(), I32x4::new(2, 2, 2, 4));
assert_eq!(a.zyyw(), I32x4::new(3, 2, 2, 4));
assert_eq!(a.wyyw(), I32x4::new(4, 2, 2, 4));
assert_eq!(a.xzyw(), I32x4::new(1, 3, 2, 4));
assert_eq!(a.yzyw(), I32x4::new(2, 3, 2, 4));
assert_eq!(a.zzyw(), I32x4::new(3, 3, 2, 4));
assert_eq!(a.wzyw(), I32x4::new(4, 3, 2, 4));
assert_eq!(a.xwyw(), I32x4::new(1, 4, 2, 4));
assert_eq!(a.ywyw(), I32x4::new(2, 4, 2, 4));
assert_eq!(a.zwyw(), I32x4::new(3, 4, 2, 4));
assert_eq!(a.wwyw(), I32x4::new(4, 4, 2, 4));
assert_eq!(a.xxzw(), I32x4::new(1, 1, 3, 4));
assert_eq!(a.yxzw(), I32x4::new(2, 1, 3, 4));
assert_eq!(a.zxzw(), I32x4::new(3, 1, 3, 4));
assert_eq!(a.wxzw(), I32x4::new(4, 1, 3, 4));
assert_eq!(a.xyzw(), I32x4::new(1, 2, 3, 4));
assert_eq!(a.yyzw(), I32x4::new(2, 2, 3, 4));
assert_eq!(a.zyzw(), I32x4::new(3, 2, 3, 4));
assert_eq!(a.wyzw(), I32x4::new(4, 2, 3, 4));
assert_eq!(a.xzzw(), I32x4::new(1, 3, 3, 4));
assert_eq!(a.yzzw(), I32x4::new(2, 3, 3, 4));
assert_eq!(a.zzzw(), I32x4::new(3, 3, 3, 4));
assert_eq!(a.wzzw(), I32x4::new(4, 3, 3, 4));
assert_eq!(a.xwzw(), I32x4::new(1, 4, 3, 4));
assert_eq!(a.ywzw(), I32x4::new(2, 4, 3, 4));
assert_eq!(a.zwzw(), I32x4::new(3, 4, 3, 4));
assert_eq!(a.wwzw(), I32x4::new(4, 4, 3, 4));
assert_eq!(a.xxww(), I32x4::new(1, 1, 4, 4));
assert_eq!(a.yxww(), I32x4::new(2, 1, 4, 4));
assert_eq!(a.zxww(), I32x4::new(3, 1, 4, 4));
assert_eq!(a.wxww(), I32x4::new(4, 1, 4, 4));
assert_eq!(a.xyww(), I32x4::new(1, 2, 4, 4));
assert_eq!(a.yyww(), I32x4::new(2, 2, 4, 4));
assert_eq!(a.zyww(), I32x4::new(3, 2, 4, 4));
assert_eq!(a.wzww(), I32x4::new(4, 3, 4, 4));
assert_eq!(a.xzww(), I32x4::new(1, 3, 4, 4));
assert_eq!(a.yzww(), I32x4::new(2, 3, 4, 4));
assert_eq!(a.zzww(), I32x4::new(3, 3, 4, 4));
assert_eq!(a.wzww(), I32x4::new(4, 3, 4, 4));
assert_eq!(a.xwww(), I32x4::new(1, 4, 4, 4));
assert_eq!(a.ywww(), I32x4::new(2, 4, 4, 4));
assert_eq!(a.zwww(), I32x4::new(3, 4, 4, 4));
}