diff options
Diffstat (limited to 'results/classifier/118/review/2386')
| -rw-r--r-- | results/classifier/118/review/2386 | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/results/classifier/118/review/2386 b/results/classifier/118/review/2386 new file mode 100644 index 000000000..270f52dc6 --- /dev/null +++ b/results/classifier/118/review/2386 @@ -0,0 +1,103 @@ +register: 0.937 +risc-v: 0.931 +graphic: 0.899 +performance: 0.895 +ppc: 0.839 +files: 0.834 +socket: 0.812 +device: 0.808 +vnc: 0.803 +PID: 0.762 +network: 0.759 +arm: 0.758 +architecture: 0.746 +kernel: 0.733 +permissions: 0.697 +assembly: 0.688 +debug: 0.684 +TCG: 0.644 +mistranslation: 0.640 +x86: 0.631 +semantic: 0.624 +boot: 0.615 +VMM: 0.575 +KVM: 0.565 +hypervisor: 0.556 +user-level: 0.533 +peripherals: 0.532 +i386: 0.522 +virtual: 0.377 +-------------------- +files: 0.215 +assembly: 0.161 +semantic: 0.116 +risc-v: 0.060 +debug: 0.057 +register: 0.017 +PID: 0.013 +user-level: 0.012 +architecture: 0.010 +virtual: 0.008 +TCG: 0.007 +hypervisor: 0.006 +device: 0.005 +performance: 0.004 +network: 0.003 +socket: 0.003 +boot: 0.003 +kernel: 0.002 +peripherals: 0.002 +permissions: 0.002 +graphic: 0.002 +mistranslation: 0.002 +vnc: 0.001 +VMM: 0.001 +KVM: 0.000 +arm: 0.000 +i386: 0.000 +ppc: 0.000 +x86: 0.000 + +RISCV - Incorrect behaviour of the SLL instruction +Description of problem: +`SLL` (and probably other similar instructions) produce incorrect results. To quote the [RISCV ISA manual](https://drive.google.com/file/d/1uviu1nH-tScFfgrovvFCrj7Omv8tFtkp/view): + +> SLL, SRL, and SRA perform logical left, logical right, and arithmetic right shifts on the value in register +rs1 by the shift amount held in the lower 5 bits of register rs2. + +This instruction should perform a logical shift left by the shift amount from the lower 5 bits held in the third operand, however, it doesn't seem to be the case. As can be seen from the result of the snippet below: `55c3585000000000`, it seems that it calculates the correct value, but then shifts it by another 32 bits to the left: + +```python +correct_shift_res = (0xDB4D6868655C3585 << (0x69C99AB9B9401024 & 0b11111)) & (2 ** 64 - 1) +incorrect_qemu_produced = (correct_shift_res << 32) & (2 ** 64 - 1) +``` +Steps to reproduce: +1. Compile the attached source file: `riscv64-linux-gnu-gcc -static repro.c -o ./repro.elf` + +```c +#include <stdint.h> +#include <stdio.h> + +int main() { + uint64_t a = 0x69C99AB9B9401024; + uint64_t b = 0xDB4D6868655C3585; + uint64_t c; + + asm volatile("sll %0, %1, %2" : "=r"(c) : "r"(b), "r"(a)); + + printf("s8 : %lx\n", c); + printf("expected: %lx\n", 0xb4d6868655c35850); + + return 0; +} +``` + +2. Run qemu: `./qemu-riscv64 ./repro.elf` +3. You will see the output and what the result of the computation should really be: + +``` +s8 : 55c3585000000000 +expected: b4d6868655c35850 +``` +Additional information: + |