summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-08-16 10:22:54 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-08-16 10:22:54 +0000
commita59012577cc2cfab98d56b66c85d304a49cf6c4d (patch)
tree0f291d53a0c4a86eb14da6c906739dad819fb9ae /clang/lib/CodeGen
parent2df9ee6ec8560363e2ee47ebde7dfdb2beae5219 (diff)
downloadbcm5719-llvm-a59012577cc2cfab98d56b66c85d304a49cf6c4d.tar.gz
bcm5719-llvm-a59012577cc2cfab98d56b66c85d304a49cf6c4d.zip
[SystemZ] Fix sign of integer memcmp result
r188163 used CLC to implement memcmp. Code that compares the result directly against zero can test the CC value produced by CLC, but code that needs an integer result must use IPM. The sequence I'd used was: ipm <reg> sll <reg>, 2 sra <reg>, 30 but I'd forgotten that this inverts the order, so that CC==1 ("less") becomes an integer greater than zero, and CC==2 ("greater") becomes an integer less than zero. This sequence should only be used if the CLC arguments are reversed to compensate. The problem then is that the branch condition must also be reversed when testing the CLC result directly. Rather than do that, I went for a different sequence that works with the natural CLC order: ipm <reg> srl <reg>, 28 rll <reg>, <reg>, 31 One advantage of this is that it doesn't clobber CC. A disadvantage is that any sign extension to 64 bits must be done separately, rather than being folded into the shifts. llvm-svn: 188538
Diffstat (limited to 'clang/lib/CodeGen')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud