`,
                pos: []string{"\tFIDBR\t[$]5"},
        },
+       {
+               fn: `
+               func roundToEven(x float64) float64 {
+                       return math.RoundToEven(x)
+               }
+               `,
+               pos: []string{"\tFIDBR\t[$]4"},
+       },
        {
                // check that stack store is optimized away
                fn: `
 
                        return s.newValue1(ssa.OpRound, types.Types[TFLOAT64], args[0])
                },
                sys.S390X)
+       addF("math", "RoundToEven",
+               func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
+                       return s.newValue1(ssa.OpRoundToEven, types.Types[TFLOAT64], args[0])
+               },
+               sys.S390X)
        addF("math", "Abs",
                func(s *state, n *Node, args []*ssa.Value) *ssa.Value {
                        return s.newValue1(ssa.OpAbs, types.Types[TFLOAT64], args[0])
 
 (Bswap32 x) -> (MOVWBR x)
 
 // math package intrinsics
-(Sqrt  x) -> (FSQRT x)
-(Floor x) -> (FIDBR [7] x)
-(Ceil  x) -> (FIDBR [6] x)
-(Trunc x) -> (FIDBR [5] x)
-(Round x) -> (FIDBR [1] x)
+(Sqrt        x) -> (FSQRT x)
+(Floor       x) -> (FIDBR [7] x)
+(Ceil        x) -> (FIDBR [6] x)
+(Trunc       x) -> (FIDBR [5] x)
+(RoundToEven x) -> (FIDBR [4] x)
+(Round       x) -> (FIDBR [1] x)
 
 // Atomic loads.
 (AtomicLoad32 ptr mem) -> (MOVWZatomicload ptr mem)
 
        //   ±∞  → ±∞ (sign preserved)
        //   ±0  → ±0 (sign preserved)
        //   NaN → NaN
-       {name: "Floor", argLength: 1}, // round arg0 toward -∞
-       {name: "Ceil", argLength: 1},  // round arg0 toward +∞
-       {name: "Trunc", argLength: 1}, // round arg0 toward 0
-       {name: "Round", argLength: 1}, // round arg0 to nearest, ties away from 0
+       {name: "Floor", argLength: 1},       // round arg0 toward -∞
+       {name: "Ceil", argLength: 1},        // round arg0 toward +∞
+       {name: "Trunc", argLength: 1},       // round arg0 toward 0
+       {name: "Round", argLength: 1},       // round arg0 to nearest, ties away from 0
+       {name: "RoundToEven", argLength: 1}, // round arg0 to nearest, ties to even
 
        // Modify the sign bit
        {name: "Abs", argLength: 1},      // absolute value arg0
 
        OpCeil
        OpTrunc
        OpRound
+       OpRoundToEven
        OpAbs
        OpCopysign
        OpPhi
                argLen:  1,
                generic: true,
        },
+       {
+               name:    "RoundToEven",
+               argLen:  1,
+               generic: true,
+       },
        {
                name:    "Abs",
                argLen:  1,
 
                return rewriteValueS390X_OpRound32F_0(v)
        case OpRound64F:
                return rewriteValueS390X_OpRound64F_0(v)
+       case OpRoundToEven:
+               return rewriteValueS390X_OpRoundToEven_0(v)
        case OpRsh16Ux16:
                return rewriteValueS390X_OpRsh16Ux16_0(v)
        case OpRsh16Ux32:
                return true
        }
 }
+func rewriteValueS390X_OpRoundToEven_0(v *Value) bool {
+       // match: (RoundToEven x)
+       // cond:
+       // result: (FIDBR [4] x)
+       for {
+               x := v.Args[0]
+               v.reset(OpS390XFIDBR)
+               v.AuxInt = 4
+               v.AddArg(x)
+               return true
+       }
+}
 func rewriteValueS390X_OpRsh16Ux16_0(v *Value) bool {
        b := v.Block
        _ = b