Index: gcc/testsuite/gcc.target/arm/neon-vset_lanes8.c =================================================================== --- gcc/testsuite/gcc.target/arm/neon-vset_lanes8.c (revision 0) +++ gcc/testsuite/gcc.target/arm/neon-vset_lanes8.c (revision 0) @@ -0,0 +1,21 @@ +/* Test the `vset_lane_s8' ARM Neon intrinsic. */ + +/* { dg-do run } */ +/* { dg-require-effective-target arm_neon_hw } */ +/* { dg-options "-O0" } */ +/* { dg-add-options arm_neon } */ + +#include "arm_neon.h" +#include +#include + +int8x8_t x = { 1, 2, 3, 4, 5, 6, 7, 8 }; +int8x8_t y = { 1, 2, 3, 16, 5, 6, 7, 8 }; + +int main (void) +{ + x = vset_lane_s8 (16, x, 3); + if (memcmp (&x, &y, sizeof (x)) != 0) + abort(); + return 0; +} Index: gcc/config/arm/neon.md =================================================================== --- gcc/config/arm/neon.md (revision 173299) +++ gcc/config/arm/neon.md (working copy) @@ -426,7 +426,7 @@ (match_operand:SI 2 "immediate_operand" "i")))] "TARGET_NEON" { - int elt = ffs ((int) INTVAL (operands[2]) - 1); + int elt = ffs ((int) INTVAL (operands[2])) - 1; if (BYTES_BIG_ENDIAN) elt = GET_MODE_NUNITS (mode) - 1 - elt; operands[2] = GEN_INT (elt);