Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: src/arm/assembler-arm.cc

Issue 2124022: Update and improve support for ARMv7 bitfield instructions.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/disasm-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 896
897 void Assembler::bx(Register target, Condition cond) { // v5 and above, plus v4t 897 void Assembler::bx(Register target, Condition cond) { // v5 and above, plus v4t
898 WriteRecordedPositions(); 898 WriteRecordedPositions();
899 ASSERT(!target.is(pc)); // use of pc is actually allowed, but discouraged 899 ASSERT(!target.is(pc)); // use of pc is actually allowed, but discouraged
900 emit(cond | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | B4 | target.code()); 900 emit(cond | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | B4 | target.code());
901 } 901 }
902 902
903 903
904 // Data-processing instructions. 904 // Data-processing instructions.
905 905
906 // UBFX <Rd>,<Rn>,#<lsb>,#<width - 1>
907 // Instruction details available in ARM DDI 0406A, A8-464.
908 // cond(31-28) | 01111(27-23)| 1(22) | 1(21) | widthm1(20-16) |
909 // Rd(15-12) | lsb(11-7) | 101(6-4) | Rn(3-0)
910 void Assembler::ubfx(Register dst, Register src1, const Operand& src2,
911 const Operand& src3, Condition cond) {
912 ASSERT(!src2.rm_.is_valid() && !src3.rm_.is_valid());
913 ASSERT(static_cast<uint32_t>(src2.imm32_) <= 0x1f);
914 ASSERT(static_cast<uint32_t>(src3.imm32_) <= 0x1f);
915 emit(cond | 0x3F*B21 | src3.imm32_*B16 |
916 dst.code()*B12 | src2.imm32_*B7 | 0x5*B4 | src1.code());
917 }
918
919
920 void Assembler::and_(Register dst, Register src1, const Operand& src2, 906 void Assembler::and_(Register dst, Register src1, const Operand& src2,
921 SBit s, Condition cond) { 907 SBit s, Condition cond) {
922 addrmod1(cond | 0*B21 | s, src1, dst, src2); 908 addrmod1(cond | 0*B21 | s, src1, dst, src2);
923 } 909 }
924 910
925 911
926 void Assembler::eor(Register dst, Register src1, const Operand& src2, 912 void Assembler::eor(Register dst, Register src1, const Operand& src2,
927 SBit s, Condition cond) { 913 SBit s, Condition cond) {
928 addrmod1(cond | 1*B21 | s, src1, dst, src2); 914 addrmod1(cond | 1*B21 | s, src1, dst, src2);
929 } 915 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 1085
1100 // Miscellaneous arithmetic instructions. 1086 // Miscellaneous arithmetic instructions.
1101 void Assembler::clz(Register dst, Register src, Condition cond) { 1087 void Assembler::clz(Register dst, Register src, Condition cond) {
1102 // v5 and above. 1088 // v5 and above.
1103 ASSERT(!dst.is(pc) && !src.is(pc)); 1089 ASSERT(!dst.is(pc) && !src.is(pc));
1104 emit(cond | B24 | B22 | B21 | 15*B16 | dst.code()*B12 | 1090 emit(cond | B24 | B22 | B21 | 15*B16 | dst.code()*B12 |
1105 15*B8 | B4 | src.code()); 1091 15*B8 | B4 | src.code());
1106 } 1092 }
1107 1093
1108 1094
1095 // Bitfield manipulation instructions.
1096
1097 // Unsigned bit field extract.
1098 // Extracts #width adjacent bits from position #lsb in a register, and
1099 // writes them to the low bits of a destination register.
1100 // ubfx dst, src, #lsb, #width
1101 void Assembler::ubfx(Register dst,
1102 Register src,
1103 int lsb,
1104 int width,
1105 Condition cond) {
1106 // v7 and above.
1107 ASSERT(CpuFeatures::IsSupported(ARMv7));
1108 ASSERT(!dst.is(pc) && !src.is(pc));
1109 ASSERT((lsb >= 0) && (lsb <= 31));
1110 ASSERT((width >= 1) && (width <= (32 - lsb)));
1111 emit(cond | 0xf*B23 | B22 | B21 | (width - 1)*B16 | dst.code()*B12 |
1112 lsb*B7 | B6 | B4 | src.code());
1113 }
1114
1115
1116 // Signed bit field extract.
1117 // Extracts #width adjacent bits from position #lsb in a register, and
1118 // writes them to the low bits of a destination register. The extracted
1119 // value is sign extended to fill the destination register.
1120 // sbfx dst, src, #lsb, #width
1121 void Assembler::sbfx(Register dst,
1122 Register src,
1123 int lsb,
1124 int width,
1125 Condition cond) {
1126 // v7 and above.
1127 ASSERT(CpuFeatures::IsSupported(ARMv7));
1128 ASSERT(!dst.is(pc) && !src.is(pc));
1129 ASSERT((lsb >= 0) && (lsb <= 31));
1130 ASSERT((width >= 1) && (width <= (32 - lsb)));
1131 emit(cond | 0xf*B23 | B21 | (width - 1)*B16 | dst.code()*B12 |
1132 lsb*B7 | B6 | B4 | src.code());
1133 }
1134
1135
1136 // Bit field clear.
1137 // Sets #width adjacent bits at position #lsb in the destination register
1138 // to zero, preserving the value of the other bits.
1139 // bfc dst, #lsb, #width
1140 void Assembler::bfc(Register dst, int lsb, int width, Condition cond) {
1141 // v7 and above.
1142 ASSERT(CpuFeatures::IsSupported(ARMv7));
1143 ASSERT(!dst.is(pc));
1144 ASSERT((lsb >= 0) && (lsb <= 31));
1145 ASSERT((width >= 1) && (width <= (32 - lsb)));
1146 int msb = lsb + width - 1;
1147 emit(cond | 0x1f*B22 | msb*B16 | dst.code()*B12 | lsb*B7 | B4 | 0xf);
1148 }
1149
1150
1151 // Bit field insert.
1152 // Inserts #width adjacent bits from the low bits of the source register
1153 // into position #lsb of the destination register.
1154 // bfi dst, src, #lsb, #width
1155 void Assembler::bfi(Register dst,
1156 Register src,
1157 int lsb,
1158 int width,
1159 Condition cond) {
1160 // v7 and above.
1161 ASSERT(CpuFeatures::IsSupported(ARMv7));
1162 ASSERT(!dst.is(pc) && !src.is(pc));
1163 ASSERT((lsb >= 0) && (lsb <= 31));
1164 ASSERT((width >= 1) && (width <= (32 - lsb)));
1165 int msb = lsb + width - 1;
1166 emit(cond | 0x1f*B22 | msb*B16 | dst.code()*B12 | lsb*B7 | B4 |
1167 src.code());
1168 }
1169
1170
1109 // Status register access instructions. 1171 // Status register access instructions.
1110 void Assembler::mrs(Register dst, SRegister s, Condition cond) { 1172 void Assembler::mrs(Register dst, SRegister s, Condition cond) {
1111 ASSERT(!dst.is(pc)); 1173 ASSERT(!dst.is(pc));
1112 emit(cond | B24 | s | 15*B16 | dst.code()*B12); 1174 emit(cond | B24 | s | 15*B16 | dst.code()*B12);
1113 } 1175 }
1114 1176
1115 1177
1116 void Assembler::msr(SRegisterFieldMask fields, const Operand& src, 1178 void Assembler::msr(SRegisterFieldMask fields, const Operand& src,
1117 Condition cond) { 1179 Condition cond) {
1118 ASSERT(fields >= B16 && fields < B20); // at least one field set 1180 ASSERT(fields >= B16 && fields < B20); // at least one field set
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 2269
2208 // Since a constant pool was just emitted, move the check offset forward by 2270 // Since a constant pool was just emitted, move the check offset forward by
2209 // the standard interval. 2271 // the standard interval.
2210 next_buffer_check_ = pc_offset() + kCheckConstInterval; 2272 next_buffer_check_ = pc_offset() + kCheckConstInterval;
2211 } 2273 }
2212 2274
2213 2275
2214 } } // namespace v8::internal 2276 } } // namespace v8::internal
2215 2277
2216 #endif // V8_TARGET_ARCH_ARM 2278 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/disasm-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698