|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | +; RUN: llc -O0 -o - %s | FileCheck %s |
| 3 | +; RUN: llc -O3 -o - %s | FileCheck %s --check-prefix=SUBOPTIMAL |
| 4 | +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" |
| 5 | +target triple = "aarch64-arm-none-eabi" |
| 6 | + |
| 7 | +declare float @llvm.experimental.constrained.sitofp.f32.i32(i32, metadata, metadata) |
| 8 | +declare float @llvm.experimental.constrained.sitofp.f32.i16(i16, metadata, metadata) |
| 9 | +declare i1 @llvm.experimental.constrained.fcmp.f32(float, float, metadata, metadata) |
| 10 | +declare float @llvm.experimental.constrained.uitofp.f32.i16(i16, metadata, metadata) |
| 11 | + |
| 12 | +define i32 @test() #0 { |
| 13 | +; CHECK-LABEL: test: |
| 14 | +; CHECK: // %bb.0: // %entry |
| 15 | +; CHECK-NEXT: mov w8, #1 |
| 16 | +; CHECK-NEXT: scvtf s0, w8 |
| 17 | +; CHECK-NEXT: fcmp s0, s0 |
| 18 | +; CHECK-NEXT: cset w0, eq |
| 19 | +; CHECK-NEXT: ret |
| 20 | +; |
| 21 | +; SUBOPTIMAL-LABEL: test: |
| 22 | +; SUBOPTIMAL: // %bb.0: // %entry |
| 23 | +; SUBOPTIMAL-NEXT: mov w8, #1 |
| 24 | +; SUBOPTIMAL-NEXT: scvtf s0, w8 |
| 25 | +; SUBOPTIMAL-NEXT: mov w8, #1 |
| 26 | +; SUBOPTIMAL-NEXT: scvtf s1, w8 |
| 27 | +; SUBOPTIMAL-NEXT: fcmp s0, s1 |
| 28 | +; SUBOPTIMAL-NEXT: cset w8, eq |
| 29 | +; SUBOPTIMAL-NEXT: and w0, w8, #0x1 |
| 30 | +; SUBOPTIMAL-NEXT: ret |
| 31 | +entry: |
| 32 | + %conv = call float @llvm.experimental.constrained.sitofp.f32.i32(i32 1, metadata !"round.tonearest", metadata !"fpexcept.strict") |
| 33 | + %conv1 = call float @llvm.experimental.constrained.sitofp.f32.i16(i16 1, metadata !"round.tonearest", metadata !"fpexcept.strict") |
| 34 | + %cmp = call i1 @llvm.experimental.constrained.fcmp.f32(float %conv, float %conv1, metadata !"oeq", metadata !"fpexcept.strict") |
| 35 | + %conv2 = zext i1 %cmp to i32 |
| 36 | + ret i32 %conv2 |
| 37 | +} |
| 38 | + |
| 39 | +define i32 @test2() #0 { |
| 40 | +; CHECK-LABEL: test2: |
| 41 | +; CHECK: // %bb.0: // %entry |
| 42 | +; CHECK-NEXT: mov w8, #1 |
| 43 | +; CHECK-NEXT: scvtf s0, w8 |
| 44 | +; CHECK-NEXT: ucvtf s1, w8 |
| 45 | +; CHECK-NEXT: fcmp s0, s1 |
| 46 | +; CHECK-NEXT: cset w0, eq |
| 47 | +; CHECK-NEXT: ret |
| 48 | +; |
| 49 | +; SUBOPTIMAL-LABEL: test2: |
| 50 | +; SUBOPTIMAL: // %bb.0: // %entry |
| 51 | +; SUBOPTIMAL-NEXT: mov w8, #1 |
| 52 | +; SUBOPTIMAL-NEXT: scvtf s0, w8 |
| 53 | +; SUBOPTIMAL-NEXT: mov w8, #1 |
| 54 | +; SUBOPTIMAL-NEXT: ucvtf s1, w8 |
| 55 | +; SUBOPTIMAL-NEXT: fcmp s0, s1 |
| 56 | +; SUBOPTIMAL-NEXT: cset w8, eq |
| 57 | +; SUBOPTIMAL-NEXT: and w0, w8, #0x1 |
| 58 | +; SUBOPTIMAL-NEXT: ret |
| 59 | +entry: |
| 60 | + %conv = call float @llvm.experimental.constrained.sitofp.f32.i32(i32 1, metadata !"round.tonearest", metadata !"fpexcept.strict") |
| 61 | + %conv1 = call float @llvm.experimental.constrained.uitofp.f32.i16(i16 1, metadata !"round.tonearest", metadata !"fpexcept.strict") |
| 62 | + %cmp = call i1 @llvm.experimental.constrained.fcmp.f32(float %conv, float %conv1, metadata !"oeq", metadata !"fpexcept.strict") |
| 63 | + %conv2 = zext i1 %cmp to i32 |
| 64 | + ret i32 %conv2 |
| 65 | +} |
| 66 | + |
| 67 | +attributes #0 = { noinline optnone } |
0 commit comments