File: pr114901.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (56 lines) | stat: -rw-r--r-- 2,634 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=sse2 | FileCheck %s --check-prefixes=SSE
; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=avx2 | FileCheck %s --check-prefixes=AVX

; PR114901 - ensure that the ASHR node doesn't commute the operands.
define i1 @PR114901(<4 x i32> %a) {
; SSE-LABEL: define i1 @PR114901(
; SSE-SAME: <4 x i32> [[A:%.*]]) #[[ATTR0:[0-9]+]] {
; SSE-NEXT:    [[E1:%.*]] = extractelement <4 x i32> [[A]], i32 1
; SSE-NEXT:    [[E3:%.*]] = extractelement <4 x i32> [[A]], i32 3
; SSE-NEXT:    [[CMP1:%.*]] = icmp sgt i32 [[E1]], -8
; SSE-NEXT:    [[CMP3:%.*]] = icmp sgt i32 [[E3]], 42
; SSE-NEXT:    [[R:%.*]] = ashr i1 [[CMP3]], [[CMP1]]
; SSE-NEXT:    ret i1 [[R]]
;
; AVX-LABEL: define i1 @PR114901(
; AVX-SAME: <4 x i32> [[A:%.*]]) #[[ATTR0:[0-9]+]] {
; AVX-NEXT:    [[TMP1:%.*]] = icmp sgt <4 x i32> [[A]], <i32 poison, i32 -8, i32 poison, i32 42>
; AVX-NEXT:    [[SHIFT:%.*]] = shufflevector <4 x i1> [[TMP1]], <4 x i1> poison, <4 x i32> <i32 poison, i32 3, i32 poison, i32 poison>
; AVX-NEXT:    [[TMP2:%.*]] = ashr <4 x i1> [[SHIFT]], [[TMP1]]
; AVX-NEXT:    [[R:%.*]] = extractelement <4 x i1> [[TMP2]], i64 1
; AVX-NEXT:    ret i1 [[R]]
;
  %e1 = extractelement <4 x i32> %a, i32 1
  %e3 = extractelement <4 x i32> %a, i32 3
  %cmp1 = icmp sgt i32 %e1, 4294967288
  %cmp3 = icmp sgt i32 %e3, 42
  %r = ashr i1 %cmp3, %cmp1
  ret i1 %r
}

define i1 @PR114901_flip(<4 x i32> %a) {
; SSE-LABEL: define i1 @PR114901_flip(
; SSE-SAME: <4 x i32> [[A:%.*]]) #[[ATTR0]] {
; SSE-NEXT:    [[E1:%.*]] = extractelement <4 x i32> [[A]], i32 1
; SSE-NEXT:    [[E3:%.*]] = extractelement <4 x i32> [[A]], i32 3
; SSE-NEXT:    [[CMP1:%.*]] = icmp sgt i32 [[E1]], -8
; SSE-NEXT:    [[CMP3:%.*]] = icmp sgt i32 [[E3]], 42
; SSE-NEXT:    [[R:%.*]] = ashr i1 [[CMP1]], [[CMP3]]
; SSE-NEXT:    ret i1 [[R]]
;
; AVX-LABEL: define i1 @PR114901_flip(
; AVX-SAME: <4 x i32> [[A:%.*]]) #[[ATTR0]] {
; AVX-NEXT:    [[TMP1:%.*]] = icmp sgt <4 x i32> [[A]], <i32 poison, i32 -8, i32 poison, i32 42>
; AVX-NEXT:    [[SHIFT:%.*]] = shufflevector <4 x i1> [[TMP1]], <4 x i1> poison, <4 x i32> <i32 poison, i32 3, i32 poison, i32 poison>
; AVX-NEXT:    [[TMP2:%.*]] = ashr <4 x i1> [[TMP1]], [[SHIFT]]
; AVX-NEXT:    [[R:%.*]] = extractelement <4 x i1> [[TMP2]], i64 1
; AVX-NEXT:    ret i1 [[R]]
;
  %e1 = extractelement <4 x i32> %a, i32 1
  %e3 = extractelement <4 x i32> %a, i32 3
  %cmp1 = icmp sgt i32 %e1, 4294967288
  %cmp3 = icmp sgt i32 %e3, 42
  %r = ashr i1 %cmp1, %cmp3
  ret i1 %r
}