D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10445 - add .min, .max, etc. properties for vector types
Summary: add .min, .max, etc. properties for vector types
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords: pull, SIMD
Depends on:
Blocks:
 
Reported: 2013-06-22 07:40 UTC by bearophile_hugs
Modified: 2020-12-22 11:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2013-06-22 07:40:22 UTC
This SIMD code compiles, but it's not handy:

import core.simd;
void main() {
    enum U = ubyte.max;
    ubyte16 m = [U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U];
}


So maybe it's worth adding the ".max" and ".min" attributes to simd registers, to allow:

import core.simd;
void main() {
    auto a = ubyte16.max; // All initialized to ubyte.max.
    auto b = int4.min; // All initizialized to int.min.
}

This also allows to write simd code that looks more like regular code.
Comment 1 Walter Bright 2016-11-20 08:21:06 UTC
You can do things like:

  ubyte16 a = ubyte.max;

as broadcasting works.
Comment 2 Dlang Bot 2020-12-22 07:31:28 UTC
@WalterBright created dlang/dmd pull request #12045 "fix Issue 10445 - add .min, .max, etc. properties for vector types" fixing this issue:

- fix Issue 10445 - add .min, .max, etc. properties for vector types

https://github.com/dlang/dmd/pull/12045
Comment 3 Dlang Bot 2020-12-22 08:06:46 UTC
@WalterBright created dlang/dlang.org pull request #2922 "fix Issue 10445 - add .min, .max, etc. properties for vector types" fixing this issue:

- fix Issue 10445 - add .min, .max, etc. properties for vector types

https://github.com/dlang/dlang.org/pull/2922
Comment 4 Dlang Bot 2020-12-22 09:33:51 UTC
dlang/dmd pull request #12045 "fix Issue 10445 - add .min, .max, etc. properties for vector types" was merged into master:

- ff88025b51b8074f930295f4a735b76af554e973 by Walter Bright:
  fix Issue 10445 - add .min, .max, etc. properties for vector types

https://github.com/dlang/dmd/pull/12045
Comment 5 Dlang Bot 2020-12-22 11:17:40 UTC
dlang/dlang.org pull request #2922 "fix Issue 10445 - add .min, .max, etc. properties for vector types" was merged into master:

- 40e9255d5be18f984b042c389657c4422244c88f by Walter Bright:
  fix Issue 10445 - add .min, .max, etc. properties for vector types

https://github.com/dlang/dlang.org/pull/2922