2016-08-21 16:02:27 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 | FileCheck %s --check-prefix=CHECK --check-prefix=NOAVX512
|
|
|
|
; RUN: llc < %s -fast-isel -fast-isel-abort=1 -mtriple=x86_64-apple-darwin10 -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512
|
2014-06-24 05:55:36 +08:00
|
|
|
|
|
|
|
; Test conditional move for the supported types (i16, i32, and i32) and
|
|
|
|
; conditon input (argument or cmp). Currently i8 is not supported.
|
|
|
|
|
|
|
|
define zeroext i16 @select_cmov_i16(i1 zeroext %cond, i16 zeroext %a, i16 zeroext %b) {
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-LABEL: select_cmov_i16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-NEXT: testb $1, %dil
|
|
|
|
; CHECK-NEXT: cmovew %dx, %si
|
|
|
|
; CHECK-NEXT: movzwl %si, %eax
|
|
|
|
; CHECK-NEXT: retq
|
2014-06-24 05:55:36 +08:00
|
|
|
%1 = select i1 %cond, i16 %a, i16 %b
|
|
|
|
ret i16 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define zeroext i16 @select_cmp_cmov_i16(i16 zeroext %a, i16 zeroext %b) {
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-LABEL: select_cmp_cmov_i16:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-NEXT: cmpw %si, %di
|
|
|
|
; CHECK-NEXT: cmovbw %di, %si
|
|
|
|
; CHECK-NEXT: movzwl %si, %eax
|
|
|
|
; CHECK-NEXT: retq
|
2014-06-24 05:55:36 +08:00
|
|
|
%1 = icmp ult i16 %a, %b
|
|
|
|
%2 = select i1 %1, i16 %a, i16 %b
|
|
|
|
ret i16 %2
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @select_cmov_i32(i1 zeroext %cond, i32 %a, i32 %b) {
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-LABEL: select_cmov_i32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-NEXT: movl %esi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: testb $1, %dil
|
|
|
|
; CHECK-NEXT: cmovel %edx, %eax
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-NEXT: retq
|
2014-06-24 05:55:36 +08:00
|
|
|
%1 = select i1 %cond, i32 %a, i32 %b
|
|
|
|
ret i32 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @select_cmp_cmov_i32(i32 %a, i32 %b) {
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-LABEL: select_cmp_cmov_i32:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-NEXT: movl %esi, %eax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: cmpl %esi, %edi
|
|
|
|
; CHECK-NEXT: cmovbl %edi, %eax
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-NEXT: retq
|
2014-06-24 05:55:36 +08:00
|
|
|
%1 = icmp ult i32 %a, %b
|
|
|
|
%2 = select i1 %1, i32 %a, i32 %b
|
|
|
|
ret i32 %2
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @select_cmov_i64(i1 zeroext %cond, i64 %a, i64 %b) {
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-LABEL: select_cmov_i64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-NEXT: movq %rsi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: testb $1, %dil
|
|
|
|
; CHECK-NEXT: cmoveq %rdx, %rax
|
2017-03-29 00:35:29 +08:00
|
|
|
; CHECK-NEXT: retq
|
2014-06-24 05:55:36 +08:00
|
|
|
%1 = select i1 %cond, i64 %a, i64 %b
|
|
|
|
ret i64 %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @select_cmp_cmov_i64(i64 %a, i64 %b) {
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-LABEL: select_cmp_cmov_i64:
|
2017-12-05 01:18:51 +08:00
|
|
|
; CHECK: ## %bb.0:
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-NEXT: movq %rsi, %rax
|
2018-09-20 02:59:08 +08:00
|
|
|
; CHECK-NEXT: cmpq %rsi, %rdi
|
|
|
|
; CHECK-NEXT: cmovbq %rdi, %rax
|
2016-08-21 16:02:27 +08:00
|
|
|
; CHECK-NEXT: retq
|
2014-06-24 05:55:36 +08:00
|
|
|
%1 = icmp ult i64 %a, %b
|
|
|
|
%2 = select i1 %1, i64 %a, i64 %b
|
|
|
|
ret i64 %2
|
|
|
|
}
|
|
|
|
|