Rem returns x % y. The types of the two values must be equal.
(x, y *Value)
| 226 | |
| 227 | // Rem returns x % y. The types of the two values must be equal. |
| 228 | func (b *Builder) Rem(x, y *Value) *Value { |
| 229 | assertTypesEqual(x.Type(), y.Type()) |
| 230 | ty := Scalar(x.Type()) |
| 231 | name := x.Name() + "%" + y.Name() |
| 232 | switch { |
| 233 | case IsSignedInteger(ty): |
| 234 | return b.val(ty, b.llvm.CreateSRem(x.llvm, y.llvm, name)) |
| 235 | case IsUnsignedInteger(ty): |
| 236 | return b.val(ty, b.llvm.CreateURem(x.llvm, y.llvm, name)) |
| 237 | case IsFloat(ty): |
| 238 | return b.val(ty, b.llvm.CreateFRem(x.llvm, y.llvm, name)) |
| 239 | default: |
| 240 | panic(fmt.Errorf("Cannot divide values of type %v", ty)) |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | // DivS returns x / y. The types of the two values must be equal. |
| 245 | func (b *Builder) DivS(x *Value, y interface{}) *Value { |
nothing calls this directly
no test coverage detected