[valgrind] [Bug 402519] POWER 3.0 addex instruction incorrectly implemented
https://bugs.kde.org/show_bug.cgi?id=402519 Mark Wielaard changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #3 from Mark Wielaard --- Carl reviewed and double checked API test results. Pushed to master. commit 2c1f016e634bf79faf45e81c14c955c711bc202f Author: Mark Wielaard Date: Mon Dec 31 22:26:31 2018 +0100 Bug 402519 - POWER 3.0 addex instruction incorrectly implemented addex uses OV as carry in and carry out. For all other instructions OV is the signed overflow flag. And instructions like adde use CA as carry. Replace set_XER_OV_OV32 with set_XER_OV_OV32_ADDEX, which will call calculate_XER_CA_64 and calculate_XER_CA_32, but with OV as input, and sets OV and OV32. Enable test_addex in none/tests/ppc64/test_isa_3_0.c and update the expected output. test_addex would fail to match the expected output before this patch. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 402519] POWER 3.0 addex instruction incorrectly implemented
https://bugs.kde.org/show_bug.cgi?id=402519 Mark Wielaard changed: What|Removed |Added Assignee|jsew...@acm.org |m...@klomp.org --- Comment #2 from Mark Wielaard --- Created attachment 117217 --> https://bugs.kde.org/attachment.cgi?id=117217&action=edit Fix addex instruction implementation https://code.wildebeest.org/git/user/mjw/valgrind/commit/?h=power9-addex -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 402519] POWER 3.0 addex instruction incorrectly implemented
https://bugs.kde.org/show_bug.cgi?id=402519 Mark Wielaard changed: What|Removed |Added Status|REPORTED|ASSIGNED Ever confirmed|0 |1 --- Comment #1 from Mark Wielaard --- Some more details from private email(s). This was originally reported as an issue with GMP on power9. Here is some example code: File t.c: #include unsigned long f(); int main () { unsigned long foo = f(); for (int i = 56; i >= 0; i -= 8) printf ("%c", (char) (foo >> i)); printf ("\n"); return 0; } File f.s: .globl f .type f, @function f: li 5, 0x6E63 addis 5, 5, 0x7269 li 6, 0x6C67 addis 6, 6, 0x5661 insrdi 5, 6, 32, 0 li 3, -1 subfo 0, 0, 0 # OV <- 0 addex 4, 3, 3, 0 # OV <- 1 addex 3, 3, 3, 0 # r3 <- 0xff..ff + 0xff..ff + 1 = 0xff..fe = -2 sub 3, 5, 3 blr $ gcc -std=c99 t.c f.s $ valgrind ./a.out Correct output is "Valgrind". Output under Valgrind: "Valgrine". There is actually a testcase for addex in valgrind none/tests/ppc64/test_isa_3_0.c. But it is commented out. And indeed, it fails when enabled. The issue seems to be that the XER OV flag is set wrongly. The code in calculate_XER_OV_64 () does: /* (argL^argR^-1) & (argL^res) & (1<<63) ? 1:0 */ // i.e. ((both_same_sign) & (sign_changed) & (sign_mask)) Which checks for two's complements overflow. But addex is akin to adde except that addex inputs carry from OV and outputs carry to OV, while adde of course uses CA. The meaning of OV for other instructions is signed overflow. -- You are receiving this mail because: You are watching all bug changes.
[valgrind] [Bug 402519] POWER 3.0 addex instruction incorrectly implemented
https://bugs.kde.org/show_bug.cgi?id=402519 Julian Seward changed: What|Removed |Added CC||c...@us.ibm.com, ||m...@klomp.org -- You are receiving this mail because: You are watching all bug changes.