instruction 'denbcdq' misbehaving
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Instruction 'denbcdq' appears to have no effect. Test case attached.
On ppc64le native:
--
gcc -g -O -mcpu=power9 bcdcfsq.c test-denbcdq.c -o test-denbcdq
$ ./test-denbcdq
0x0000000000000
0x0000000000000
0x2208000000000
$ ./test-denbcdq 1
0x0000000000000
0x0000000000000
0x2208000000000
$ ./test-denbcdq $(seq 0 99)
0x0000000000000
0x0000000000000
0x2208000000000
--
With "qemu-ppc64le -cpu power9"
--
$ qemu-ppc64le -cpu power9 -L [...] ./test-denbcdq
0x0000000000000
0x0000000000000
0x0000000000000
$ qemu-ppc64le -cpu power9 -L [...] ./test-denbcdq 1
0x0000000000000
0x0000000000000
0x0000000000000
$ qemu-ppc64le -cpu power9 -L [...] ./test-denbcdq $(seq 100)
0x0000000000000
0x0000000000000
0x0000000000000
--
I started looking at the code, but I got confused rather quickly. Could be related to endianness? I think denbcdq arrived on the scene before little-endian was a big deal. Maybe something to do with utilizing implicit floating-point register pairs... I don't think the right data is getting to helper_denbcdq, which would point back to the gen_fprp_ptr uses in dfp-impl.inc.c (GEN_DFP_
tags: | added: ppc64 testcase |
I tried to compile your test program with 2 different GCC versions but it keeps failing, do you need a special/recent version? Meanwhile can you attach a statically linked binary?
$ gcc -v
gcc version 6.3.0 20170516 (Debian 6.3.0-18)
$ gcc -g -O -mcpu=power9 test-denbcdq.c -o test-denbcdq
test-denbcdq.c: In function 'bcdcfsq':
test-denbcdq.c:7:2: error: impossible register constraint in 'asm'
asm volatile ( "bcdcfsq. %0,%1,0" : "=v" (r) : "v" (i128) );
^~~
--
$ gcc version 8.1.1 20180626 (Red Hat Cross 8.1.1-3) (GCC)
$ gcc -g -O -mcpu=power9 test-denbcdq.c -o test-denbcdq c:15:3: error: decimal floating point not supported for this target
test-denbcdq.c: In function ‘main’:
test-denbcdq.
_Decimal128 d128;
^~~~~~~~~~~