aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2019-02-07 18:18:16 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2019-02-07 18:18:16 +0000
commit8544ed6eea68a80999504c8a4b21b77d29cd86e2 (patch)
treee6eed6a6e7e0ba6c0e7e187fac794816343c70f5 /gcc/tree-vectorizer.c
parent2b99b6c0cc2fd1da7c9d1d66c39212d7f3e4bc65 (diff)
downloadgcc-8544ed6eea68a80999504c8a4b21b77d29cd86e2.zip
gcc-8544ed6eea68a80999504c8a4b21b77d29cd86e2.tar.gz
gcc-8544ed6eea68a80999504c8a4b21b77d29cd86e2.tar.bz2
[AArch64] Change representation of SABD in RTL
Richard raised a concern about the RTL we use to represent the AdvSIMD SABD (vector signed absolute difference) instruction. We currently represent it as ABS (MINUS op1 op2). This isn't exactly what SABD does. ABS treats its input as a signed value and returns the absolute of that. For example: (sabd:QI 64 -128) == 192 (unsigned) aka -64 (signed) whereas (minus:QI 64 -128) == 192 (unsigned) aka -64 (signed), (abs ...) of that is 64. A better way to describe the instruction is with MINUS (SMAX (op1 op2) SMIN (op1 op2)). This patch implements that, and also implements similar semantics for the UABD instruction that uses UMAX and UMIN. That way for the example above we'll have: (minus:QI (smax:QI (64 -128)) (smin:QI (64 -128))) == (minus:QI 64 -128) == 192 (or -64 signed) which matches what SABD does. * config/aarch64/iterators.md (max_opp): New code_attr. (USMAX): New code iterator. * config/aarch64/predicates.md (aarch64_smin): New predicate. (aarch64_smax): Likewise. * config/aarch64/aarch64-simd.md (abd<mode>_3): Rename to... (*aarch64_<su>abd<mode>_3): ... Change RTL representation to MINUS (MAX MIN). * gcc.target/aarch64/abd_1.c: New test. * gcc.dg/sabd_1.c: Likewise. From-SVN: r268658
Diffstat (limited to 'gcc/tree-vectorizer.c')
0 files changed, 0 insertions, 0 deletions