@@ -50,7 +50,7 @@ void Assembler::add(Register Rd, Register Rn, int64_t increment, Register temp)
50
50
}
51
51
}
52
52
53
- void Assembler::addw (Register Rd, Register Rn, int64_t increment, Register temp) {
53
+ void Assembler::addw (Register Rd, Register Rn, int32_t increment, Register temp) {
54
54
if (is_imm_in_range (increment, 12 , 0 )) {
55
55
addiw (Rd, Rn, increment);
56
56
} else {
@@ -70,7 +70,7 @@ void Assembler::sub(Register Rd, Register Rn, int64_t decrement, Register temp)
70
70
}
71
71
}
72
72
73
- void Assembler::subw (Register Rd, Register Rn, int64_t decrement, Register temp) {
73
+ void Assembler::subw (Register Rd, Register Rn, int32_t decrement, Register temp) {
74
74
if (is_imm_in_range (-decrement, 12 , 0 )) {
75
75
addiw (Rd, Rn, -decrement);
76
76
} else {
@@ -117,30 +117,30 @@ void Assembler::_li(Register Rd, int64_t imm) {
117
117
}
118
118
119
119
void Assembler::li64 (Register Rd, int64_t imm) {
120
- // Load upper 32 bits. upper = imm[63:32], but if imm[31] == 1 or
121
- // (imm[31:20] == 0x7ff && imm[19] == 1), upper = imm[63:32] + 1.
122
- int64_t lower = imm & 0xffffffff ;
123
- lower -= ((lower << 44 ) >> 44 );
124
- int64_t tmp_imm = ((uint64_t )(imm & 0xffffffff00000000 )) + (uint64_t )lower;
125
- int32_t upper = (tmp_imm - (int32_t )lower) >> 32 ;
126
-
127
- // Load upper 32 bits
128
- int64_t up = upper, lo = upper;
129
- lo = (lo << 52 ) >> 52 ;
130
- up -= lo;
131
- up = (int32_t )up;
132
- lui (Rd, up);
133
- addi (Rd, Rd, lo);
134
-
135
- // Load the rest 32 bits.
136
- slli (Rd, Rd, 12 );
137
- addi (Rd, Rd, (int32_t )lower >> 20 );
138
- slli (Rd, Rd, 12 );
139
- lower = ((int32_t )imm << 12 ) >> 20 ;
140
- addi (Rd, Rd, lower);
141
- slli (Rd, Rd, 8 );
142
- lower = imm & 0xff ;
143
- addi (Rd, Rd, lower);
120
+ // Load upper 32 bits. upper = imm[63:32], but if imm[31] == 1 or
121
+ // (imm[31:20] == 0x7ff && imm[19] == 1), upper = imm[63:32] + 1.
122
+ int64_t lower = imm & 0xffffffff ;
123
+ lower -= ((lower << 44 ) >> 44 );
124
+ int64_t tmp_imm = ((uint64_t )(imm & 0xffffffff00000000 )) + (uint64_t )lower;
125
+ int32_t upper = (tmp_imm - (int32_t )lower) >> 32 ;
126
+
127
+ // Load upper 32 bits
128
+ int64_t up = upper, lo = upper;
129
+ lo = (lo << 52 ) >> 52 ;
130
+ up -= lo;
131
+ up = (int32_t )up;
132
+ lui (Rd, up);
133
+ addi (Rd, Rd, lo);
134
+
135
+ // Load the rest 32 bits.
136
+ slli (Rd, Rd, 12 );
137
+ addi (Rd, Rd, (int32_t )lower >> 20 );
138
+ slli (Rd, Rd, 12 );
139
+ lower = ((int32_t )imm << 12 ) >> 20 ;
140
+ addi (Rd, Rd, lower);
141
+ slli (Rd, Rd, 8 );
142
+ lower = imm & 0xff ;
143
+ addi (Rd, Rd, lower);
144
144
}
145
145
146
146
void Assembler::li32 (Register Rd, int32_t imm) {
0 commit comments