Skip to content

Commit

Permalink
[DPWBS-1387] Add legality rules for G_FCOPYSIGN
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar Solymosi committed Mar 13, 2020
1 parent 4b68264 commit 6031c44
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm/lib/Target/TriCore/TriCoreLegalizerInfo.cpp
Expand Up @@ -169,6 +169,9 @@ TriCoreLegalizerInfo::TriCoreLegalizerInfo(const TriCoreSubtarget &ST) {

// Floating point Ops

// G_FCOPYSIGN is legal for s32 and s64 types
getActionDefinitionsBuilder(G_FCOPYSIGN).legalFor({{s32, s32}, {s64, s64}});

// G_FMINNUM and G_FMAXNUM are legal for tc18 otherwise it should be lowered
auto &FMinNumMaxNumActions =
getActionDefinitionsBuilder({G_FMAXNUM, G_FMINNUM})
Expand Down
35 changes: 35 additions & 0 deletions llvm/test/CodeGen/TriCore/GlobalIsel/legalize-fcopysign.mir
@@ -0,0 +1,35 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -mtriple=tricore -global-isel -run-pass=legalizer \
# RUN: -verify-machineinstrs %s -o - | FileCheck %s

---
name: fcopysign_s32
body: |
bb.0.entry:
; CHECK-LABEL: name: fcopysign_s32
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $d4
; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $d5
; CHECK: [[FCOPYSIGN:%[0-9]+]]:_(s32) = G_FCOPYSIGN [[COPY]], [[COPY1]](s32)
; CHECK: $d4 = COPY [[FCOPYSIGN]](s32)
%0:_(s32) = COPY $d4
%1:_(s32) = COPY $d5
%2:_(s32) = G_FCOPYSIGN %0, %1
$d4 = COPY %2(s32)
...

---
name: fcopysign_s64
body: |
bb.0.entry:
; CHECK-LABEL: name: fcopysign_s64
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $e4
; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $e6
; CHECK: [[FCOPYSIGN:%[0-9]+]]:_(s64) = G_FCOPYSIGN [[COPY]], [[COPY1]](s64)
; CHECK: $e4 = COPY [[FCOPYSIGN]](s64)
%0:_(s64) = COPY $e4
%1:_(s64) = COPY $e6
%2:_(s64) = G_FCOPYSIGN %0, %1
$e4 = COPY %2(s64)
...

0 comments on commit 6031c44

Please sign in to comment.