public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "igorr at gitatechnologies dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug sim/18407] New: Bfin simulator - error in handling >>> (S), when shift value > 16 Date: Wed, 13 May 2015 11:02:00 -0000 [thread overview] Message-ID: <bug-18407-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=18407 Bug ID: 18407 Summary: Bfin simulator - error in handling >>> (S), when shift value > 16 Product: gdb Version: 7.9 Status: NEW Severity: normal Priority: P2 Component: sim Assignee: unassigned at sourceware dot org Reporter: igorr at gitatechnologies dot com CC: vapier at gentoo dot org Target Milestone: --- 1. Let's compile the following code: $ cat > test1.s .global __start __start: LINK 0xc ; R1 = 2 ; R1 = R1 >>> 1; R1 = 2; R1 = R1 >> 1; R1 = 2; R1 = R1 >>> 1 (S); R1 = 2; .byte 0x82, 0xc6, 0xf9, 0x43 ; UNLINK; RTS; $ bfin-linux-uclibc-gcc -nostdlib test1.s -o test1 2. Run objdump on it: bfin-linux-uclibc-objdump -d test1 test1: file format elf32-bfinfdpic Disassembly of section .text: 00000074 <__start>: 74: 00 e8 03 00 LINK 0xc; /* (12) */ 78: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 7a: 82 c6 f9 03 R1 = R1 >>> 0x1; 7e: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 80: 82 c6 f9 83 R1 = R1 >> 0x1; 84: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 86: 82 c6 f9 43 R1 = R1 << 0x3f (S); 8a: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 8c: 82 c6 f9 43 R1 = R1 << 0x3f (S); 90: 01 e8 00 00 UNLINK; 94: 10 00 RTS; 3. Bug/Feature (binutils?) R1 = R1 >>> 1(S) is displayed as R1 = R1 << 0x3f (S); 4. Let's compile and run this code on VisualDSP++ environment simulator. in all 4 cases R1 will get the value 0x1 after the shift 5. Let's run the same test in bfin-simulator: $ bfin-linux-uclibc-gdb test1 GNU gdb (GDB) 7.9 ...<skip> Reading symbols from test1...(no debugging symbols found)...done. (gdb) b *0x74 Breakpoint 1 at 0x74 (gdb) set disassemble-next-line on (gdb) target sim Connected to the simulator. (gdb) load Loading section .text, size 0x24 lma 0x74 Start address 0x74 Transfer rate: 288 bits in <1 sec. (gdb) r Starting program: ./test1 Breakpoint 1, 0x00000074 in _start () => 0x00000074 <_start+0>: 00 e8 03 00 LINK 0xc; /* (12) */ (gdb) display/x $r1 1: /x $r1 = 0x0 (gdb) si 0x00000078 in _start () => 0x00000078 <_start+4>: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 1: /x $r1 = 0x0 (gdb) si 0x0000007a in _start () => 0x0000007a <_start+6>: 82 c6 f9 03 R1 = R1 >>> 0x1; 1: /x $r1 = 0x2 (gdb) si 0x0000007e in _start () => 0x0000007e <_start+10>: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 1: /x $r1 = 0x1 (gdb) si 0x00000080 in _start () => 0x00000080 <_start+12>: 82 c6 f9 83 R1 = R1 >> 0x1; 1: /x $r1 = 0x2 (gdb) si 0x00000084 in _start () => 0x00000084 <_start+16>: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 1: /x $r1 = 0x1 (gdb) si 0x00000086 in _start () => 0x00000086 <_start+18>: 82 c6 f9 43 R1 = R1 << 0x3f (S); 1: /x $r1 = 0x2 (gdb) si 0x0000008a in _start () => 0x0000008a <_start+22>: 11 60 R1 = 0x2 (X); /* R1=0x2( 2) */ 1: /x $r1 = 0x7fffffff (gdb) 6. Bug. After the last shift R1 should be equal to 0x1. Saturated shift Right is treated as saturated shift left. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2015-05-13 11:02 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-05-13 11:02 igorr at gitatechnologies dot com [this message] 2015-05-13 11:06 ` [Bug sim/18407] " igorr at gitatechnologies dot com 2015-05-13 11:12 ` igorr at gitatechnologies dot com 2015-05-13 16:02 ` vapier at gentoo dot org 2015-05-13 16:16 ` igorr at gitatechnologies dot com 2015-05-13 16:56 ` vapier at gentoo dot org 2015-10-11 7:43 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-18407-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).