summaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ/SystemZ.h
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-08-20 09:38:48 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-08-20 09:38:48 +0000
commit8c20158fb0e1e5d747077f065eb0170c5af1fbfa (patch)
treea5028d38ab70ecdac91c2e7d4cb257931f18e978 /lib/Target/SystemZ/SystemZ.h
parent74e81aae7c07b0619a77a5a0a56fdb954ce4b8fd (diff)
downloadllvm-8c20158fb0e1e5d747077f065eb0170c5af1fbfa.tar.gz
llvm-8c20158fb0e1e5d747077f065eb0170c5af1fbfa.tar.bz2
llvm-8c20158fb0e1e5d747077f065eb0170c5af1fbfa.tar.xz
[SystemZ] Use SRST to optimize memchr
SystemZTargetLowering::emitStringWrapper() previously loaded the character into R0 before the loop and made R0 live on entry. I'd forgotten that allocatable registers weren't allowed to be live across blocks at this stage, and it confused LiveVariables enough to cause a miscompilation of f3 in memchr-02.ll. This patch instead loads R0 in the loop and leaves LICM to hoist it after RA. This is actually what I'd tried originally, but I went for the manual optimisation after noticing that R0 often wasn't being hoisted. This bug forced me to go back and look at why, now fixed as r188774. We should also try to optimize null checks so that they test the CC result of the SRST directly. The select between null and the SRST GPR result could then usually be deleted as dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ/SystemZ.h')
-rw-r--r--lib/Target/SystemZ/SystemZ.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/SystemZ/SystemZ.h b/lib/Target/SystemZ/SystemZ.h
index eccc2aa4d5..bb6ceac83b 100644
--- a/lib/Target/SystemZ/SystemZ.h
+++ b/lib/Target/SystemZ/SystemZ.h
@@ -52,6 +52,11 @@ namespace llvm {
const unsigned CCMASK_CS_NE = CCMASK_1;
const unsigned CCMASK_CS = CCMASK_0 | CCMASK_1;
+ // Condition-code mask assignments for a completed SRST loop.
+ const unsigned CCMASK_SRST_FOUND = CCMASK_1;
+ const unsigned CCMASK_SRST_NOTFOUND = CCMASK_2;
+ const unsigned CCMASK_SRST = CCMASK_1 | CCMASK_2;
+
// Return true if Val fits an LLILL operand.
static inline bool isImmLL(uint64_t Val) {
return (Val & ~0x000000000000ffffULL) == 0;