`eval($2+$1)')')
C Apply op x, x, y, for each x.
-C OP_YXX(OP, Y, X1, X2, ...)
-define(`OP_YXX',
+C OPN_XXY(OP, Y, X1, X2, ...)
+define(`OPN_XXY',
`$1 $3, $3, $2
ifelse(eval($# > 3), 1,
-`OP_YXX($1, $2, shift(shift(shift($@))))dnl
+`OPN_XXY($1, $2, shift(shift(shift($@))))dnl
')')
C Apply op x, x, x, y, for each x.
-C OP_YXXX(OP, Y, X1, X2, ...)
-define(`OP_YXXX',
+C OPN_XXXY(OP, Y, X1, X2, ...)
+define(`OPN_XXXY',
`$1 $3, $3, $3, $2
ifelse(eval($# > 3), 1,
-`OP_YXXX($1, $2, shift(shift(shift($@))))dnl
+`OPN_XXXY($1, $2, shift(shift(shift($@))))dnl
')')
lxvd2x VSR(S6),r30,SRC
lxvd2x VSR(S7),r31,SRC
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
- OP_YXX(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
+ OPN_XXY(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
mtctr ROUNDS
li r10,0x10
L8x_round_loop:
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vncipher, ZERO, S0, S1, S2, S3, S4, S5, S6, S7)
- OP_YXX(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
+ OPN_XXY(vncipher, ZERO, S0, S1, S2, S3, S4, S5, S6, S7)
+ OPN_XXY(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
addi r10,r10,0x10
bdnz L8x_round_loop
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vncipherlast, K, S0, S1, S2, S3, S4, S5, S6, S7)
+ OPN_XXY(vncipherlast, K, S0, S1, S2, S3, S4, S5, S6, S7)
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
stxvd2x VSR(S0),0,DST
stxvd2x VSR(S1),r25,DST
addi r9,r9,0x10
lxvd2x VSR(S3),r9,SRC
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3)')
- OP_YXX(vxor, K, S0, S1, S2, S3)
+ OPN_XXY(vxor, K, S0, S1, S2, S3)
mtctr ROUNDS
li r10,0x10
L4x_round_loop:
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vncipher, ZERO, S0, S1, S2, S3)
- OP_YXX(vxor, K, S0, S1, S2, S3)
+ OPN_XXY(vncipher, ZERO, S0, S1, S2, S3)
+ OPN_XXY(vxor, K, S0, S1, S2, S3)
addi r10,r10,0x10
bdnz L4x_round_loop
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vncipherlast, K, S0, S1, S2, S3)
+ OPN_XXY(vncipherlast, K, S0, S1, S2, S3)
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3)')
stxvd2x VSR(S0),0,DST
li r9,0x10
lxvd2x VSR(S6),r30,SRC
lxvd2x VSR(S7),r31,SRC
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
- OP_YXX(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
+ OPN_XXY(vxor, K, S0, S1, S2, S3, S4, S5, S6, S7)
mtctr ROUNDS
li r10,0x10
L8x_round_loop:
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vcipher, K, S0, S1, S2, S3, S4, S5, S6, S7)
+ OPN_XXY(vcipher, K, S0, S1, S2, S3, S4, S5, S6, S7)
addi r10,r10,0x10
bdnz L8x_round_loop
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vcipherlast, K, S0, S1, S2, S3, S4, S5, S6, S7)
+ OPN_XXY(vcipherlast, K, S0, S1, S2, S3, S4, S5, S6, S7)
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3,S4,S5,S6,S7)')
stxvd2x VSR(S0),0,DST
stxvd2x VSR(S1),r25,DST
addi r9,r9,0x10
lxvd2x VSR(S3),r9,SRC
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3)')
- OP_YXX(vxor, K, S0, S1, S2, S3)
+ OPN_XXY(vxor, K, S0, S1, S2, S3)
mtctr ROUNDS
li r10,0x10
L4x_round_loop:
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vcipher, K, S0, S1, S2, S3)
+ OPN_XXY(vcipher, K, S0, S1, S2, S3)
addi r10,r10,0x10
bdnz L4x_round_loop
lxvd2x VSR(K),r10,KEYS
vperm K,K,K,SWAP_MASK
- OP_YXX(vcipherlast, K, S0, S1, S2, S3)
+ OPN_XXY(vcipherlast, K, S0, S1, S2, S3)
-IF_LE(`OP_YXXX(vperm, SWAP_MASK, S0,S1,S2,S3)')
+IF_LE(`OPN_XXXY(vperm, SWAP_MASK, S0,S1,S2,S3)')
stxvd2x VSR(S0),0,DST
li r9,0x10