2014-05-08 22:06:24 +08:00
|
|
|
; RUN: llc < %s -mtriple=armv7-apple-ios | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-LE
|
|
|
|
; RUN: llc < %s -mtriple=thumbv7-none-linux-gnueabihf | FileCheck %s --check-prefix=CHECK-THUMB --check-prefix=CHECK-THUMB-LE
|
2014-12-18 10:20:58 +08:00
|
|
|
; RUN: llc < %s -mtriple=armebv7 -target-abi apcs | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-BE
|
2014-05-08 22:06:24 +08:00
|
|
|
; RUN: llc < %s -mtriple=thumbebv7-none-linux-gnueabihf | FileCheck %s --check-prefix=CHECK-THUMB --check-prefix=CHECK-THUMB-BE
|
2011-08-31 08:31:29 +08:00
|
|
|
|
|
|
|
define i64 @test1(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test1:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-LE: adds [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
|
|
|
; CHECK-LE: adc [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE: adds [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE: adc [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
2011-08-31 08:31:29 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test1:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-THUMB-LE: adds.w [[REG3:[a-z0-9]+]], [[REG1]]
|
|
|
|
; CHECK-THUMB-LE: adc.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: adds.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: adc.w [[REG3:[a-z0-9]+]], [[REG1]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2011-08-31 08:31:29 +08:00
|
|
|
%r = atomicrmw add i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test2(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test2:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-LE: subs [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
|
|
|
; CHECK-LE: sbc [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE: subs [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE: sbc [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
2011-08-31 08:31:29 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test2:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-THUMB-LE: subs.w [[REG3:[a-z0-9]+]], [[REG1]]
|
|
|
|
; CHECK-THUMB-LE: sbc.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: subs.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: sbc.w [[REG3:[a-z0-9]+]], [[REG1]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2011-08-31 08:31:29 +08:00
|
|
|
%r = atomicrmw sub i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test3(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test3:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-LE-DAG: and [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
|
|
|
; CHECK-LE-DAG: and [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE-DAG: and [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE-DAG: and [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
2011-08-31 08:31:29 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test3:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-THUMB-LE-DAG: and.w [[REG3:[a-z0-9]+]], [[REG1]]
|
|
|
|
; CHECK-THUMB-LE-DAG: and.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE-DAG: and.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE-DAG: and.w [[REG3:[a-z0-9]+]], [[REG1]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2011-08-31 08:31:29 +08:00
|
|
|
%r = atomicrmw and i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test4(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test4:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-LE-DAG: orr [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
|
|
|
; CHECK-LE-DAG: orr [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE-DAG: orr [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE-DAG: orr [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
2011-08-31 08:31:29 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test4:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-THUMB-LE-DAG: orr.w [[REG3:[a-z0-9]+]], [[REG1]]
|
|
|
|
; CHECK-THUMB-LE-DAG: orr.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE-DAG: orr.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE-DAG: orr.w [[REG3:[a-z0-9]+]], [[REG1]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2011-08-31 08:31:29 +08:00
|
|
|
%r = atomicrmw or i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test5(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test5:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-LE-DAG: eor [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
|
|
|
; CHECK-LE-DAG: eor [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE-DAG: eor [[REG4:(r[0-9]?[13579])]], [[REG2]]
|
|
|
|
; CHECK-BE-DAG: eor [[REG3:(r[0-9]?[02468])]], [[REG1]]
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
2011-08-31 08:31:29 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test5:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-THUMB-LE-DAG: eor.w [[REG3:[a-z0-9]+]], [[REG1]]
|
|
|
|
; CHECK-THUMB-LE-DAG: eor.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE-DAG: eor.w [[REG4:[a-z0-9]+]], [[REG2]]
|
|
|
|
; CHECK-THUMB-BE-DAG: eor.w [[REG3:[a-z0-9]+]], [[REG1]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[REG3]], [[REG4]]
|
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2011-08-31 08:31:29 +08:00
|
|
|
%r = atomicrmw xor i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test6(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test6:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, {{r[0-9]?[02468]}}, {{r[0-9]?[13579]}}
|
2011-08-31 08:31:29 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test6:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, {{[a-z0-9]+}}, {{[a-z0-9]+}}
|
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2011-08-31 08:31:29 +08:00
|
|
|
%r = atomicrmw xchg i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
2011-08-31 08:41:05 +08:00
|
|
|
}
|
2011-09-01 01:52:22 +08:00
|
|
|
|
|
|
|
define i64 @test7(i64* %ptr, i64 %val1, i64 %val2) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test7:
|
2014-06-14 00:45:52 +08:00
|
|
|
; CHECK-DAG: mov [[VAL1LO:r[0-9]+]], r1
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2016-02-23 04:55:50 +08:00
|
|
|
; CHECK-LE-DAG: eor [[MISMATCH_LO:.*]], [[REG1]], [[VAL1LO]]
|
|
|
|
; CHECK-LE-DAG: eor [[MISMATCH_HI:.*]], [[REG2]], r2
|
|
|
|
; CHECK-BE-DAG: eor [[MISMATCH_LO:.*]], [[REG2]], r2
|
|
|
|
; CHECK-BE-DAG: eor [[MISMATCH_HI:.*]], [[REG1]], r1
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: orrs {{r[0-9]+}}, [[MISMATCH_LO]], [[MISMATCH_HI]]
|
2011-09-01 01:52:22 +08:00
|
|
|
; CHECK: bne
|
2016-02-23 04:55:50 +08:00
|
|
|
; CHECK-DAG: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, {{r[0-9]?[02468]}}, {{r[0-9]?[13579]}}
|
2011-09-01 01:52:22 +08:00
|
|
|
; CHECK: cmp
|
2016-02-23 04:55:50 +08:00
|
|
|
; CHECK: beq
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test7:
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
2014-05-08 22:06:24 +08:00
|
|
|
; CHECK-THUMB-LE-DAG: eor.w [[MISMATCH_LO:[a-z0-9]+]], [[REG1]], r2
|
|
|
|
; CHECK-THUMB-LE-DAG: eor.w [[MISMATCH_HI:[a-z0-9]+]], [[REG2]], r3
|
2014-05-30 18:09:59 +08:00
|
|
|
; CHECK-THUMB-BE-DAG: eor.w [[MISMATCH_HI:[a-z0-9]+]], [[REG1]], r2
|
|
|
|
; CHECK-THUMB-BE-DAG: eor.w [[MISMATCH_LO:[a-z0-9]+]], [[REG2]], r3
|
2016-02-23 04:55:50 +08:00
|
|
|
; CHECK-THUMB-LE: orrs.w {{.*}}, [[MISMATCH_LO]], [[MISMATCH_HI]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: bne
|
2016-02-23 04:55:50 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, {{[a-z0-9]+}}, {{[a-z0-9]+}}
|
|
|
|
; CHECK-THUMB: cmp
|
2016-02-23 04:55:50 +08:00
|
|
|
; CHECK-THUMB: beq
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
IR: add "cmpxchg weak" variant to support permitted failure.
This commit adds a weak variant of the cmpxchg operation, as described
in C++11. A cmpxchg instruction with this modifier is permitted to
fail to store, even if the comparison indicated it should.
As a result, cmpxchg instructions must return a flag indicating
success in addition to their original iN value loaded. Thus, for
uniformity *all* cmpxchg instructions now return "{ iN, i1 }". The
second flag is 1 when the store succeeded.
At the DAG level, a new ATOMIC_CMP_SWAP_WITH_SUCCESS node has been
added as the natural representation for the new cmpxchg instructions.
It is a strong cmpxchg.
By default this gets Expanded to the existing ATOMIC_CMP_SWAP during
Legalization, so existing backends should see no change in behaviour.
If they wish to deal with the enhanced node instead, they can call
setOperationAction on it. Beware: as a node with 2 results, it cannot
be selected from TableGen.
Currently, no use is made of the extra information provided in this
patch. Test updates are almost entirely adapting the input IR to the
new scheme.
Summary for out of tree users:
------------------------------
+ Legacy Bitcode files are upgraded during read.
+ Legacy assembly IR files will be invalid.
+ Front-ends must adapt to different type for "cmpxchg".
+ Backends should be unaffected by default.
llvm-svn: 210903
2014-06-13 22:24:07 +08:00
|
|
|
%pair = cmpxchg i64* %ptr, i64 %val1, i64 %val2 seq_cst seq_cst
|
|
|
|
%r = extractvalue { i64, i1 } %pair, 0
|
2011-09-01 01:52:22 +08:00
|
|
|
ret i64 %r
|
|
|
|
}
|
2011-09-01 02:26:09 +08:00
|
|
|
|
2013-09-26 20:22:36 +08:00
|
|
|
; Compiles down to a single ldrexd
|
2011-09-01 02:26:09 +08:00
|
|
|
define i64 @test8(i64* %ptr) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test8:
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2015-12-03 02:12:57 +08:00
|
|
|
; CHECK-NOT: strexd
|
|
|
|
; CHECK: clrex
|
|
|
|
; CHECK-NOT: strexd
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test8:
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
2015-12-03 02:12:57 +08:00
|
|
|
; CHECK-THUMB-NOT: strexd
|
|
|
|
; CHECK-THUMB: clrex
|
|
|
|
; CHECK-THUMB-NOT: strexd
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2015-02-28 05:17:42 +08:00
|
|
|
%r = load atomic i64, i64* %ptr seq_cst, align 8
|
2011-09-01 02:26:09 +08:00
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
; Compiles down to atomicrmw xchg; there really isn't any more efficient
|
|
|
|
; way to write it.
|
|
|
|
define void @test9(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test9:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-17 05:55:34 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, {{r[0-9]?[02468]}}, {{r[0-9]?[13579]}}
|
2011-09-01 02:26:09 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test9:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, {{[a-z0-9]+}}, {{[a-z0-9]+}}
|
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2011-09-01 02:26:09 +08:00
|
|
|
store atomic i64 %val, i64* %ptr seq_cst, align 8
|
|
|
|
ret void
|
|
|
|
}
|
2012-11-29 22:41:25 +08:00
|
|
|
|
|
|
|
define i64 @test10(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test10:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: mov [[OUT_HI:[a-z0-9]+]], r2
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-LE: subs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK-BE: subs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-LE: sbcs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-BE: sbcs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK: mov [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK: movwge [[CMP]], #1
|
|
|
|
; CHECK: cmp [[CMP]], #0
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK: mov [[OUT_LO:[a-z0-9]+]], r1
|
|
|
|
; CHECK: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test10:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: mov [[OUT_LO:[a-z0-9]+]], r2
|
|
|
|
; CHECK-THUMB-LE: subs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB-BE: subs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-LE: sbcs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: sbcs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB: mov.w [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK-THUMB: movge.w [[CMP]], #1
|
|
|
|
; CHECK-THUMB: cmp.w [[CMP]], #0
|
|
|
|
; CHECK-THUMB: mov [[OUT_HI:[a-z0-9]+]], r3
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK-THUMB: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK-THUMB: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2012-11-29 22:41:25 +08:00
|
|
|
%r = atomicrmw min i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test11(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test11:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: mov [[OUT_HI:[a-z0-9]+]], r2
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-LE: subs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK-BE: subs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-LE: sbcs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-BE: sbcs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK: mov [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK: movwhs [[CMP]], #1
|
|
|
|
; CHECK: cmp [[CMP]], #0
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK: mov [[OUT_LO:[a-z0-9]+]], r1
|
|
|
|
; CHECK: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test11:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: mov [[OUT_LO:[a-z0-9]+]], r2
|
|
|
|
; CHECK-THUMB-LE: subs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB-BE: subs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-LE: sbcs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: sbcs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB: mov.w [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK-THUMB: movhs.w [[CMP]], #1
|
|
|
|
; CHECK-THUMB: cmp.w [[CMP]], #0
|
|
|
|
; CHECK-THUMB: mov [[OUT_HI:[a-z0-9]+]], r3
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK-THUMB: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK-THUMB: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2012-11-29 22:41:25 +08:00
|
|
|
%r = atomicrmw umin i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test12(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test12:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: mov [[OUT_HI:[a-z0-9]+]], r2
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-LE: subs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK-BE: subs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-LE: sbcs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-BE: sbcs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK: mov [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK: movwlt [[CMP]], #1
|
|
|
|
; CHECK: cmp [[CMP]], #0
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK: mov [[OUT_LO:[a-z0-9]+]], r1
|
|
|
|
; CHECK: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test12:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: mov [[OUT_LO:[a-z0-9]+]], r2
|
|
|
|
; CHECK-THUMB-LE: subs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB-BE: subs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-LE: sbcs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: sbcs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB: mov.w [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK-THUMB: movlt.w [[CMP]], #1
|
|
|
|
; CHECK-THUMB: cmp.w [[CMP]], #0
|
|
|
|
; CHECK-THUMB: mov [[OUT_HI:[a-z0-9]+]], r3
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK-THUMB: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK-THUMB: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2012-11-29 22:41:25 +08:00
|
|
|
%r = atomicrmw max i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @test13(i64* %ptr, i64 %val) {
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test13:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: ldrexd [[REG1:(r[0-9]?[02468])]], [[REG2:(r[0-9]?[13579])]]
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: mov [[OUT_HI:[a-z0-9]+]], r2
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-LE: subs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK-BE: subs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-LE: sbcs {{[^,]+}}, r2, [[REG2]]
|
|
|
|
; CHECK-BE: sbcs {{[^,]+}}, r1, [[REG1]]
|
|
|
|
; CHECK: mov [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK: movwlo [[CMP]], #1
|
|
|
|
; CHECK: cmp [[CMP]], #0
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK: mov [[OUT_LO:[a-z0-9]+]], r1
|
|
|
|
; CHECK: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2012-11-29 22:41:25 +08:00
|
|
|
; CHECK: cmp
|
|
|
|
; CHECK: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-THUMB-LABEL: test13:
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: ldrexd [[REG1:[a-z0-9]+]], [[REG2:[a-z0-9]+]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: mov [[OUT_LO:[a-z0-9]+]], r2
|
|
|
|
; CHECK-THUMB-LE: subs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB-BE: subs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-LE: sbcs.w {{[^,]+}}, r3, [[REG2]]
|
|
|
|
; CHECK-THUMB-BE: sbcs.w {{[^,]+}}, r2, [[REG1]]
|
|
|
|
; CHECK-THUMB: mov.w [[CMP:[a-z0-9]+]], #0
|
|
|
|
; CHECK-THUMB: movlo.w [[CMP]], #1
|
|
|
|
; CHECK-THUMB: cmp.w [[CMP]], #0
|
|
|
|
; CHECK-THUMB: mov [[OUT_HI:[a-z0-9]+]], r3
|
2014-04-03 19:44:58 +08:00
|
|
|
; CHECK-THUMB: movne [[OUT_HI]], [[REG2]]
|
|
|
|
; CHECK-THUMB: movne [[OUT_LO]], [[REG1]]
|
ARM: Better codegen for 64-bit compares.
This introduces a custom lowering for ISD::SETCCE (introduced in r253572)
that allows us to emit a short code sequence for 64-bit compares.
Before:
push {r7, lr}
cmp r0, r2
mov.w r0, #0
mov.w r12, #0
it hs
movhs r0, #1
cmp r1, r3
it ge
movge.w r12, #1
it eq
moveq r12, r0
cmp.w r12, #0
bne .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
After:
push {r7, lr}
subs r0, r0, r2
sbcs.w r0, r1, r3
bge .LBB1_2
@ BB#1: @ %bb1
bl f
pop {r7, pc}
.LBB1_2: @ %bb2
bl g
pop {r7, pc}
Saves around 80KB in Chromium's libchrome.so.
Some notes on this patch:
- I don't much like the ARMISD::BRCOND and ARMISD::CMOV combines I
introduced (nothing else needs them). However, they are necessary in
order to avoid poor codegen, and they seem similar to existing combines
in other backends (e.g. X86 combines (brcond (cmp (setcc Compare))) to
(brcond Compare)).
- No support for Thumb-1. This is in principle possible, but we'd need
to implement ARMISD::SUBE for Thumb-1.
Differential Revision: http://reviews.llvm.org/D15256
llvm-svn: 263962
2016-03-22 02:00:02 +08:00
|
|
|
; CHECK-THUMB: strexd {{[a-z0-9]+}}, [[OUT_LO]], [[OUT_HI]]
|
2013-01-29 17:06:13 +08:00
|
|
|
; CHECK-THUMB: cmp
|
|
|
|
; CHECK-THUMB: bne
|
2013-07-03 17:20:36 +08:00
|
|
|
; CHECK-THUMB: dmb {{ish$}}
|
2012-11-29 22:41:25 +08:00
|
|
|
%r = atomicrmw umax i64* %ptr, i64 %val seq_cst
|
|
|
|
ret i64 %r
|
|
|
|
}
|
|
|
|
|