Skip to content

Commit 73d70fe

Browse files
authored
Merge pull request #286 from tevador/pr-zext
RISC-V: Avoid `zext.b`
2 parents e5b9c02 + e895d45 commit 73d70fe

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

src/jit_compiler_rv64_static.S

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ softaes_enc:
745745
#endif
746746

747747
/* byte 0 */
748-
zext.b x14, x30
748+
andi x14, x30, 255
749749
srli x30, x30, 8
750750
addi x12, x13, -2048
751751
#ifdef __riscv_zba
@@ -757,7 +757,7 @@ softaes_enc:
757757
lwu x14, -2048(x14)
758758

759759
/* byte 1 */
760-
zext.b x15, x30
760+
andi x15, x30, 255
761761
srli x30, x30, 8
762762
#ifdef __riscv_zba
763763
sh2add x15, x15, x12
@@ -769,7 +769,7 @@ softaes_enc:
769769
xor x8, x8, x14
770770

771771
/* byte 2 */
772-
zext.b x14, x30
772+
andi x14, x30, 255
773773
srli x30, x30, 8
774774
#ifdef __riscv_zba
775775
sh2add x14, x14, x13
@@ -781,7 +781,7 @@ softaes_enc:
781781
xor x11, x11, x15
782782

783783
/* byte 3 */
784-
zext.b x15, x30
784+
andi x15, x30, 255
785785
srli x30, x30, 8
786786
#ifdef __riscv_zba
787787
sh2add x15, x15, x13
@@ -793,7 +793,7 @@ softaes_enc:
793793
xor x10, x10, x14
794794

795795
/* byte 4 */
796-
zext.b x14, x30
796+
andi x14, x30, 255
797797
srli x30, x30, 8
798798
#ifdef __riscv_zba
799799
sh2add x14, x14, x12
@@ -805,7 +805,7 @@ softaes_enc:
805805
xor x9, x9, x15
806806

807807
/* byte 5 */
808-
zext.b x15, x30
808+
andi x15, x30, 255
809809
srli x30, x30, 8
810810
#ifdef __riscv_zba
811811
sh2add x15, x15, x12
@@ -817,7 +817,7 @@ softaes_enc:
817817
xor x9, x9, x14
818818

819819
/* byte 6 */
820-
zext.b x14, x30
820+
andi x14, x30, 255
821821
srli x30, x30, 8
822822
#ifdef __riscv_zba
823823
sh2add x14, x14, x13
@@ -829,7 +829,7 @@ softaes_enc:
829829
xor x8, x8, x15
830830

831831
/* byte 7 */
832-
zext.b x15, x30
832+
andi x15, x30, 255
833833
#ifdef __riscv_zba
834834
sh2add x15, x15, x13
835835
#else
@@ -840,7 +840,7 @@ softaes_enc:
840840
xor x11, x11, x14
841841

842842
/* byte 8 */
843-
zext.b x14, x31
843+
andi x14, x31, 255
844844
srli x31, x31, 8
845845
#ifdef __riscv_zba
846846
sh2add x14, x14, x12
@@ -852,7 +852,7 @@ softaes_enc:
852852
xor x10, x10, x15
853853

854854
/* byte 9 */
855-
zext.b x15, x31
855+
andi x15, x31, 255
856856
srli x31, x31, 8
857857
#ifdef __riscv_zba
858858
sh2add x15, x15, x12
@@ -864,7 +864,7 @@ softaes_enc:
864864
xor x10, x10, x14
865865

866866
/* byte 10 */
867-
zext.b x14, x31
867+
andi x14, x31, 255
868868
srli x31, x31, 8
869869
#ifdef __riscv_zba
870870
sh2add x14, x14, x13
@@ -876,7 +876,7 @@ softaes_enc:
876876
xor x9, x9, x15
877877

878878
/* byte 11 */
879-
zext.b x15, x31
879+
andi x15, x31, 255
880880
srli x31, x31, 8
881881
#ifdef __riscv_zba
882882
sh2add x15, x15, x13
@@ -888,7 +888,7 @@ softaes_enc:
888888
xor x8, x8, x14
889889

890890
/* byte 12 */
891-
zext.b x14, x31
891+
andi x14, x31, 255
892892
srli x31, x31, 8
893893
#ifdef __riscv_zba
894894
sh2add x14, x14, x12
@@ -900,7 +900,7 @@ softaes_enc:
900900
xor x11, x11, x15
901901

902902
/* byte 13 */
903-
zext.b x15, x31
903+
andi x15, x31, 255
904904
srli x31, x31, 8
905905
#ifdef __riscv_zba
906906
sh2add x15, x15, x12
@@ -912,7 +912,7 @@ softaes_enc:
912912
xor x11, x11, x14
913913

914914
/* byte 14 */
915-
zext.b x14, x31
915+
andi x14, x31, 255
916916
srli x31, x31, 8
917917
#ifdef __riscv_zba
918918
sh2add x14, x14, x13
@@ -924,7 +924,7 @@ softaes_enc:
924924
xor x10, x10, x15
925925

926926
/* byte 15 */
927-
zext.b x15, x31
927+
andi x15, x31, 255
928928
#ifdef __riscv_zba
929929
sh2add x15, x15, x13
930930
#else
@@ -960,7 +960,7 @@ softaes_dec:
960960
#endif
961961

962962
/* byte 0 */
963-
zext.b x14, x30
963+
andi x14, x30, 255
964964
srli x30, x30, 8
965965
addi x12, x13, -2048
966966
#ifdef __riscv_zba
@@ -972,7 +972,7 @@ softaes_dec:
972972
lwu x14, -2048(x14)
973973

974974
/* byte 1 */
975-
zext.b x15, x30
975+
andi x15, x30, 255
976976
srli x30, x30, 8
977977
#ifdef __riscv_zba
978978
sh2add x15, x15, x12
@@ -984,7 +984,7 @@ softaes_dec:
984984
xor x8, x8, x14
985985

986986
/* byte 2 */
987-
zext.b x14, x30
987+
andi x14, x30, 255
988988
srli x30, x30, 8
989989
#ifdef __riscv_zba
990990
sh2add x14, x14, x13
@@ -996,7 +996,7 @@ softaes_dec:
996996
xor x9, x9, x15
997997

998998
/* byte 3 */
999-
zext.b x15, x30
999+
andi x15, x30, 255
10001000
srli x30, x30, 8
10011001
#ifdef __riscv_zba
10021002
sh2add x15, x15, x13
@@ -1008,7 +1008,7 @@ softaes_dec:
10081008
xor x10, x10, x14
10091009

10101010
/* byte 4 */
1011-
zext.b x14, x30
1011+
andi x14, x30, 255
10121012
srli x30, x30, 8
10131013
#ifdef __riscv_zba
10141014
sh2add x14, x14, x12
@@ -1020,7 +1020,7 @@ softaes_dec:
10201020
xor x11, x11, x15
10211021

10221022
/* byte 5 */
1023-
zext.b x15, x30
1023+
andi x15, x30, 255
10241024
srli x30, x30, 8
10251025
#ifdef __riscv_zba
10261026
sh2add x15, x15, x12
@@ -1032,7 +1032,7 @@ softaes_dec:
10321032
xor x9, x9, x14
10331033

10341034
/* byte 6 */
1035-
zext.b x14, x30
1035+
andi x14, x30, 255
10361036
srli x30, x30, 8
10371037
#ifdef __riscv_zba
10381038
sh2add x14, x14, x13
@@ -1044,7 +1044,7 @@ softaes_dec:
10441044
xor x10, x10, x15
10451045

10461046
/* byte 7 */
1047-
zext.b x15, x30
1047+
andi x15, x30, 255
10481048
#ifdef __riscv_zba
10491049
sh2add x15, x15, x13
10501050
#else
@@ -1055,7 +1055,7 @@ softaes_dec:
10551055
xor x11, x11, x14
10561056

10571057
/* byte 8 */
1058-
zext.b x14, x31
1058+
andi x14, x31, 255
10591059
srli x31, x31, 8
10601060
#ifdef __riscv_zba
10611061
sh2add x14, x14, x12
@@ -1067,7 +1067,7 @@ softaes_dec:
10671067
xor x8, x8, x15
10681068

10691069
/* byte 9 */
1070-
zext.b x15, x31
1070+
andi x15, x31, 255
10711071
srli x31, x31, 8
10721072
#ifdef __riscv_zba
10731073
sh2add x15, x15, x12
@@ -1079,7 +1079,7 @@ softaes_dec:
10791079
xor x10, x10, x14
10801080

10811081
/* byte 10 */
1082-
zext.b x14, x31
1082+
andi x14, x31, 255
10831083
srli x31, x31, 8
10841084
#ifdef __riscv_zba
10851085
sh2add x14, x14, x13
@@ -1091,7 +1091,7 @@ softaes_dec:
10911091
xor x11, x11, x15
10921092

10931093
/* byte 11 */
1094-
zext.b x15, x31
1094+
andi x15, x31, 255
10951095
srli x31, x31, 8
10961096
#ifdef __riscv_zba
10971097
sh2add x15, x15, x13
@@ -1103,7 +1103,7 @@ softaes_dec:
11031103
xor x8, x8, x14
11041104

11051105
/* byte 12 */
1106-
zext.b x14, x31
1106+
andi x14, x31, 255
11071107
srli x31, x31, 8
11081108
#ifdef __riscv_zba
11091109
sh2add x14, x14, x12
@@ -1115,7 +1115,7 @@ softaes_dec:
11151115
xor x9, x9, x15
11161116

11171117
/* byte 13 */
1118-
zext.b x15, x31
1118+
andi x15, x31, 255
11191119
srli x31, x31, 8
11201120
#ifdef __riscv_zba
11211121
sh2add x15, x15, x12
@@ -1127,7 +1127,7 @@ softaes_dec:
11271127
xor x11, x11, x14
11281128

11291129
/* byte 14 */
1130-
zext.b x14, x31
1130+
andi x14, x31, 255
11311131
srli x31, x31, 8
11321132
#ifdef __riscv_zba
11331133
sh2add x14, x14, x13
@@ -1139,7 +1139,7 @@ softaes_dec:
11391139
xor x8, x8, x15
11401140

11411141
/* byte 15 */
1142-
zext.b x15, x31
1142+
andi x15, x31, 255
11431143
#ifdef __riscv_zba
11441144
sh2add x15, x15, x13
11451145
#else

0 commit comments

Comments
 (0)