Skip to content

Commit

Permalink
target/s390x: Use a 16-bit immediate in VREP
Browse files Browse the repository at this point in the history
Unlike most other instructions that contain an immediate element index,
VREP's one is 16-bit, and not 4-bit. The code uses only 8 bits, so
using, e.g., 0x101 does not lead to a specification exception.

Fix by checking all 16 bits.

Cc: qemu-stable@nongnu.org
Fixes: 28d0873 ("s390x/tcg: Implement VECTOR REPLICATE")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20230807163459.849766-1-iii@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 23e87d4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
iii-i authored and Michael Tokarev committed Sep 11, 2023
1 parent 08a4e6d commit 7c4ce14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions target/s390x/tcg/translate_vx.c.inc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#define FPF_LONG 3
#define FPF_EXT 4

static inline bool valid_vec_element(uint8_t enr, MemOp es)
static inline bool valid_vec_element(uint16_t enr, MemOp es)
{
return !(enr & ~(NUM_VEC_ELEMENTS(es) - 1));
}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ static DisasJumpType op_vpdi(DisasContext *s, DisasOps *o)

static DisasJumpType op_vrep(DisasContext *s, DisasOps *o)
{
const uint8_t enr = get_field(s, i2);
const uint16_t enr = get_field(s, i2);
const uint8_t es = get_field(s, m4);

if (es > ES_64 || !valid_vec_element(enr, es)) {
Expand Down

0 comments on commit 7c4ce14

Please sign in to comment.