Bug 400491

Summary: s390x: Operand of LOCH treated as unsigned integer
Product: [Developer tools] valgrind Reporter: Andreas Arnez <arnez>
Component: vexAssignee: Andreas Arnez <arnez>
Status: RESOLVED FIXED    
Severity: normal CC: jseward
Priority: NOR    
Version First Reported In: 3.14 SVN   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Sign-extend immediate operand of LOCHI and friends

Description Andreas Arnez 2018-10-30 18:26:32 UTC
The immediate 16-bit operand of LOCHI (load halfword immediate on condition) is treated as an unsigned integer instead of a signed integer.  This also applies to LOCHHI and LOCGHI.
Comment 1 Andreas Arnez 2018-10-30 18:44:12 UTC
Created attachment 115989 [details]
Sign-extend immediate operand of LOCHI and friends

This patch fixes the issue by offering only the non-overlapping vector registers to the register allocator.
Comment 2 Andreas Arnez 2018-10-30 18:45:26 UTC
(In reply to Andreas Arnez from comment #1)
> Created attachment 115989 [details]
> Sign-extend immediate operand of LOCHI and friends
> 
> This patch fixes the issue by offering only the non-overlapping vector
> registers to the register allocator.
Oops, comment to wrong bug.  The patch fixes the issue by sign-extending the operand.
Comment 3 Julian Seward 2018-11-09 09:42:52 UTC
(In reply to Andreas Arnez from comment #2)
> Oops, comment to wrong bug.  The patch fixes the issue by sign-extending the
> operand.

Ah, fabulous stacked casts!  I think 3 levels is a new record for this
code base.

Seems fine.  OK to land.
Comment 4 Andreas Arnez 2018-11-14 15:37:18 UTC
(In reply to Julian Seward from comment #3)
> Ah, fabulous stacked casts!  I think 3 levels is a new record for this
> code base.
Actually it's done this way in several places in this file already...

> Seems fine.  OK to land.
Thanks, pushed as git commit 9545e9f96.