2013-06-02 10:24:27 +08:00
|
|
|
; RUN: llc < %s -mtriple=sparc64-pc-openbsd -disable-sparc-leaf-proc | FileCheck %s
|
2013-05-15 01:47:27 +08:00
|
|
|
; Testing 64-bit conditionals. The sparc64 triple is an alias for sparcv9.
|
2013-04-03 12:41:44 +08:00
|
|
|
|
|
|
|
; CHECK: cmpri
|
2013-06-07 08:03:36 +08:00
|
|
|
; CHECK: cmp %i1, 1
|
2013-06-08 01:46:57 +08:00
|
|
|
; CHECK: be %xcc,
|
2013-04-03 12:41:44 +08:00
|
|
|
define void @cmpri(i64* %p, i64 %x) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp eq i64 %x, 1
|
|
|
|
br i1 %tobool, label %if.end, label %if.then
|
|
|
|
|
|
|
|
if.then:
|
|
|
|
store i64 %x, i64* %p, align 8
|
|
|
|
br label %if.end
|
|
|
|
|
|
|
|
if.end:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: cmprr
|
2013-06-07 08:03:36 +08:00
|
|
|
; CHECK: cmp %i1, %i2
|
2013-06-08 01:46:57 +08:00
|
|
|
; CHECK: bgu %xcc,
|
2013-04-03 12:41:44 +08:00
|
|
|
define void @cmprr(i64* %p, i64 %x, i64 %y) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp ugt i64 %x, %y
|
|
|
|
br i1 %tobool, label %if.end, label %if.then
|
|
|
|
|
|
|
|
if.then:
|
|
|
|
store i64 %x, i64* %p, align 8
|
|
|
|
br label %if.end
|
|
|
|
|
|
|
|
if.end:
|
|
|
|
ret void
|
|
|
|
}
|
2013-04-04 11:08:00 +08:00
|
|
|
|
|
|
|
; CHECK: selecti32_xcc
|
2013-06-07 08:03:36 +08:00
|
|
|
; CHECK: cmp %i0, %i1
|
2013-04-04 11:08:00 +08:00
|
|
|
; CHECK: movg %xcc, %i2, %i3
|
2013-06-03 05:48:17 +08:00
|
|
|
; CHECK: restore %g0, %i3, %o0
|
2013-04-04 11:08:00 +08:00
|
|
|
define i32 @selecti32_xcc(i64 %x, i64 %y, i32 %a, i32 %b) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp sgt i64 %x, %y
|
|
|
|
%rv = select i1 %tobool, i32 %a, i32 %b
|
|
|
|
ret i32 %rv
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: selecti64_xcc
|
2013-06-07 08:03:36 +08:00
|
|
|
; CHECK: cmp %i0, %i1
|
2013-04-04 11:08:00 +08:00
|
|
|
; CHECK: movg %xcc, %i2, %i3
|
2013-06-03 05:48:17 +08:00
|
|
|
; CHECK: restore %g0, %i3, %o0
|
2013-04-04 11:08:00 +08:00
|
|
|
define i64 @selecti64_xcc(i64 %x, i64 %y, i64 %a, i64 %b) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp sgt i64 %x, %y
|
|
|
|
%rv = select i1 %tobool, i64 %a, i64 %b
|
|
|
|
ret i64 %rv
|
|
|
|
}
|
2013-05-20 04:20:54 +08:00
|
|
|
|
2013-05-20 04:38:21 +08:00
|
|
|
; CHECK: selecti64_icc
|
2013-06-07 08:03:36 +08:00
|
|
|
; CHECK: cmp %i0, %i1
|
2013-05-20 04:38:21 +08:00
|
|
|
; CHECK: movg %icc, %i2, %i3
|
2013-06-03 05:48:17 +08:00
|
|
|
; CHECK: restore %g0, %i3, %o0
|
2013-05-20 04:38:21 +08:00
|
|
|
define i64 @selecti64_icc(i32 %x, i32 %y, i64 %a, i64 %b) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp sgt i32 %x, %y
|
|
|
|
%rv = select i1 %tobool, i64 %a, i64 %b
|
|
|
|
ret i64 %rv
|
|
|
|
}
|
|
|
|
|
2013-05-20 04:20:54 +08:00
|
|
|
; CHECK: selecti64_fcc
|
2018-02-24 16:24:31 +08:00
|
|
|
; CHECK: mov %i3, %i0
|
2013-05-20 04:20:54 +08:00
|
|
|
; CHECK: fcmps %f1, %f3
|
2018-02-24 16:24:31 +08:00
|
|
|
; CHECK: movul %fcc0, %i2, %i0
|
|
|
|
; CHECK: restore
|
2013-05-20 04:20:54 +08:00
|
|
|
define i64 @selecti64_fcc(float %x, float %y, i64 %a, i64 %b) {
|
|
|
|
entry:
|
|
|
|
%tobool = fcmp ult float %x, %y
|
|
|
|
%rv = select i1 %tobool, i64 %a, i64 %b
|
|
|
|
ret i64 %rv
|
|
|
|
}
|
2013-05-20 04:33:11 +08:00
|
|
|
|
|
|
|
; CHECK: selectf32_xcc
|
2014-01-12 12:13:17 +08:00
|
|
|
; CHECK: fmovs %f7, %f0
|
2018-02-24 16:24:31 +08:00
|
|
|
; CHECK: cmp %i0, %i1
|
|
|
|
; CHECK: fmovsg %xcc, %f5, %f0
|
2013-05-20 04:33:11 +08:00
|
|
|
define float @selectf32_xcc(i64 %x, i64 %y, float %a, float %b) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp sgt i64 %x, %y
|
|
|
|
%rv = select i1 %tobool, float %a, float %b
|
|
|
|
ret float %rv
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: selectf64_xcc
|
|
|
|
; CHECK: fmovd %f6, %f0
|
2018-02-24 16:24:31 +08:00
|
|
|
; CHECK: cmp %i0, %i1
|
|
|
|
; CHECK: fmovdg %xcc, %f4, %f0
|
2013-05-20 04:33:11 +08:00
|
|
|
define double @selectf64_xcc(i64 %x, i64 %y, double %a, double %b) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp sgt i64 %x, %y
|
|
|
|
%rv = select i1 %tobool, double %a, double %b
|
|
|
|
ret double %rv
|
|
|
|
}
|
2013-05-20 05:47:13 +08:00
|
|
|
|
|
|
|
; The MOVXCC instruction can't use %g0 for its tied operand.
|
|
|
|
; CHECK: select_consti64_xcc
|
2013-06-07 08:03:36 +08:00
|
|
|
; CHECK: cmp
|
2013-07-26 02:35:14 +08:00
|
|
|
; CHECK: movg %xcc, 123, %i{{[0-2]}}
|
2013-05-20 05:47:13 +08:00
|
|
|
define i64 @select_consti64_xcc(i64 %x, i64 %y) {
|
|
|
|
entry:
|
|
|
|
%tobool = icmp sgt i64 %x, %y
|
|
|
|
%rv = select i1 %tobool, i64 123, i64 0
|
|
|
|
ret i64 %rv
|
|
|
|
}
|
2013-12-09 12:02:15 +08:00
|
|
|
|
|
|
|
; CHECK-LABEL: setcc_resultty
|
2014-01-02 04:22:45 +08:00
|
|
|
; CHECK-DAG: srax %i0, 63, %o0
|
TableGen: fix operand counting for aliases
TableGen has a fairly dubious heuristic to decide whether an alias should be
printed: does the alias have lest operands than the real instruction. This is
bad enough (particularly with no way to override it), but it should at least be
calculated consistently for both strings.
This patch implements that logic: first get the *correct* string for the
variant, in the same way as the Matcher, without guessing; then count the
number of whitespace chars.
There are basically 4 changes this brings about after the previous
commits; all of these appear to be good, so I have changed the tests:
+ ARM64: we print "neg X, Y" instead of "sub X, xzr, Y".
+ ARM64: we skip implicit "uxtx" and "uxtw" modifiers.
+ Sparc: we print "mov A, B" instead of "or %g0, A, B".
+ Sparc: we print "fcmpX A, B" instead of "fcmpX %fcc0, A, B"
llvm-svn: 208969
2014-05-16 17:42:04 +08:00
|
|
|
; CHECK-DAG: mov %i0, %o1
|
|
|
|
; CHECK-DAG: mov 0, %o2
|
|
|
|
; CHECK-DAG: mov 32, %o3
|
2014-01-02 04:22:45 +08:00
|
|
|
; CHECK-DAG: call __multi3
|
2013-12-09 12:02:15 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: movne %xcc, 1, [[R:%[gilo][0-7]]]
|
|
|
|
; CHECK: or [[R]], %i1, %i0
|
|
|
|
|
|
|
|
define i1 @setcc_resultty(i64 %a, i1 %b) {
|
|
|
|
%a0 = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %a, i64 32)
|
|
|
|
%a1 = extractvalue { i64, i1 } %a0, 1
|
|
|
|
%a4 = or i1 %a1, %b
|
|
|
|
ret i1 %a4
|
|
|
|
}
|
|
|
|
|
|
|
|
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64)
|