github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/internal/obj/s390x/rotate.go (about) 1 // Copyright 2019 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 package s390x 6 7 // RotateParams represents the immediates required for a "rotate 8 // then ... selected bits instruction". 9 // 10 // The Start and End values are the indexes that represent 11 // the masked region. They are inclusive and are in big- 12 // endian order (bit 0 is the MSB, bit 63 is the LSB). They 13 // may wrap around. 14 // 15 // Some examples: 16 // 17 // Masked region | Start | End 18 // --------------------------+-------+---- 19 // 0x00_00_00_00_00_00_00_0f | 60 | 63 20 // 0xf0_00_00_00_00_00_00_00 | 0 | 3 21 // 0xf0_00_00_00_00_00_00_0f | 60 | 3 22 // 23 // The Amount value represents the amount to rotate the 24 // input left by. Note that this rotation is performed 25 // before the masked region is used. 26 type RotateParams struct { 27 Start uint8 28 End uint8 29 Amount uint8 30 } 31 32 // NewRotateParams creates a set of parameters representing a 33 // rotation left by the amount provided and a selection of the bits 34 // between the provided start and end indexes (inclusive). 35 // 36 // The start and end indexes and the rotation amount must all 37 // be in the range 0-63 inclusive or this function will panic. 38 func NewRotateParams(start, end, amount uint8) RotateParams 39 40 // RotateLeft generates a new set of parameters with the rotation amount 41 // increased by the given value. The selected bits are left unchanged. 42 func (r RotateParams) RotateLeft(amount uint8) RotateParams 43 44 // OutMask provides a mask representing the selected bits. 45 func (r RotateParams) OutMask() uint64 46 47 // InMask provides a mask representing the selected bits relative 48 // to the source value (i.e. pre-rotation). 49 func (r RotateParams) InMask() uint64 50 51 // OutMerge tries to generate a new set of parameters representing 52 // the intersection between the selected bits and the provided mask. 53 // If the intersection is unrepresentable (0 or not contiguous) nil 54 // will be returned. 55 func (r RotateParams) OutMerge(mask uint64) *RotateParams 56 57 // InMerge tries to generate a new set of parameters representing 58 // the intersection between the selected bits and the provided mask 59 // as applied to the source value (i.e. pre-rotation). 60 // If the intersection is unrepresentable (0 or not contiguous) nil 61 // will be returned. 62 func (r RotateParams) InMerge(mask uint64) *RotateParams 63 64 func (RotateParams) CanBeAnSSAAux()