- Assume That Q Is An Array Of 32 Byte Records And The Val Field Is In The First 4 Bytes Of Each Record Using X86 Code W 1 (149.36 KiB) Viewed 17 times
Assume that Q is an array of 32-byte records and the VAL field is in the first 4 bytes of each record. Using x86 code, w
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Assume that Q is an array of 32-byte records and the VAL field is in the first 4 bytes of each record. Using x86 code, w
Assume that Q is an array of 32-byte records and the VAL field is in the first 4 bytes of each record. Using x86 code, we can compile this program fragment as follows: LP: MOV IMUL MOV ADD INC CMP JNE ECX,1 EAX, ECX, 32 EBX, Q[EAX] S, EBX ECX ECX, 101 LP This program makes use of the IMUL instruction, which multiplies the second operand by the immediate value in the third operand and places the result in the first operand. A RISC advocate would like to demonstrate that a clever compiler can eliminate unnecessarily complex instructions such as IMUL. Provide the demonstration by rewriting the above x86 program without using the IMUL instruction, and write explanatory comments on each line.