diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-05-14 05:12:46 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2023-05-15 03:07:51 -0400 |
| commit | 6c6d8d67cfe14c50684c04a579c1e62bf287e8cb (patch) | |
| tree | 22be2a1952c3077a0c60c66fb4b2f47684c5bf43 /src/type.zig | |
| parent | b6d61028508c5b1e1961a124bc17d4d9bda9686f (diff) | |
| download | zig-6c6d8d67cfe14c50684c04a579c1e62bf287e8cb.tar.gz zig-6c6d8d67cfe14c50684c04a579c1e62bf287e8cb.zip | |
x86_64: redo movement, float negation, and `@fabs`
Diffstat (limited to 'src/type.zig')
| -rw-r--r-- | src/type.zig | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig index 6122afda62..bcbb9e2ea2 100644 --- a/src/type.zig +++ b/src/type.zig @@ -5433,8 +5433,18 @@ pub const Type = extern union { } } + // Works for vectors and vectors of integers. + pub fn maxInt(ty: Type, arena: Allocator, target: Target) !Value { + const scalar = try maxIntScalar(ty.scalarType(), arena, target); + if (ty.zigTypeTag() == .Vector and scalar.tag() != .the_only_possible_value) { + return Value.Tag.repeated.create(arena, scalar); + } else { + return scalar; + } + } + /// Asserts that self.zigTypeTag() == .Int. - pub fn maxInt(self: Type, arena: Allocator, target: Target) !Value { + pub fn maxIntScalar(self: Type, arena: Allocator, target: Target) !Value { assert(self.zigTypeTag() == .Int); const info = self.intInfo(target); |
