Text file src/cmd/compile/internal/ssa/_gen/RISCV64latelower.rules

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Combine bitwise operation and bitwise inversion.
     6  (AND x (NOT y)) => (ANDN x y)
     7  (OR  x (NOT y)) => (ORN  x y)
     8  (XOR x (NOT y)) => (XNOR x y)
     9  (NOT (XOR x y)) => (XNOR x y)
    10  
    11  // Fold constant shift with extension.
    12  (SRAI [c] (MOVBreg  x)) && c <   8 => (SRAI [56+c] (SLLI <typ.Int64> [56] x))
    13  (SRAI [c] (MOVHreg  x)) && c <  16 => (SRAI [48+c] (SLLI <typ.Int64> [48] x))
    14  (SRAI [c] (MOVWreg  x)) && c <  32 => (SRAI [32+c] (SLLI <typ.Int64> [32] x))
    15  (SRLI [c] (MOVBUreg x)) && c <   8 => (SRLI [56+c] (SLLI <typ.UInt64> [56] x))
    16  (SRLI [c] (MOVHUreg x)) && c <  16 => (SRLI [48+c] (SLLI <typ.UInt64> [48] x))
    17  (SRLI [c] (MOVWUreg x)) && c <  32 => (SRLI [32+c] (SLLI <typ.UInt64> [32] x))
    18  (SLLI [c] (MOVBUreg x)) && c <= 56 => (SRLI [56-c] (SLLI <typ.UInt64> [56] x))
    19  (SLLI [c] (MOVHUreg x)) && c <= 48 => (SRLI [48-c] (SLLI <typ.UInt64> [48] x))
    20  (SLLI [c] (MOVWUreg x)) && c <= 32 => (SRLI [32-c] (SLLI <typ.UInt64> [32] x))
    21  
    22  // Shift by zero.
    23  (SRAI [0] x) => x
    24  (SRLI [0] x) => x
    25  (SLLI [0] x) => x
    26  

View as plain text