-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[PowerPC] Add BCDCOPYSIGN and BCDSETSIGN Instruction Support #144874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8e287c1
33cd604
8d884fa
81c40a9
7ae44f6
1b10489
98e4799
821a032
cdfbaf9
f5b6861
c21517c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| // REQUIRES: powerpc-registered-target | ||
| // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -O2 -target-cpu pwr9 \ | ||
| // RUN: -emit-llvm %s -o - | FileCheck %s | ||
| // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -O2 -target-cpu pwr9 \ | ||
| // RUN: -emit-llvm %s -o - | FileCheck %s | ||
| // RUN: %clang_cc1 -triple powerpc-unknown-unknown -O2 -target-cpu pwr9 \ | ||
| // RUN: -emit-llvm %s -o - | FileCheck %s | ||
|
|
||
| // CHECK-LABEL: test_bcdcopysign | ||
| // CHECK: [[TMP0:%.*]] = tail call <16 x i8> @llvm.ppc.bcdcopysign(<16 x i8> %a, <16 x i8> %b) | ||
| // CHECK-NEXT: ret <16 x i8> [[TMP0]] | ||
| vector unsigned char test_bcdcopysign(vector unsigned char a, vector unsigned char b) { | ||
| return __builtin_ppc_bcdcopysign(a, b); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_bcdsetsign_imm0 | ||
| // CHECK: [[TMP0:%.*]] = tail call <16 x i8> @llvm.ppc.bcdsetsign(<16 x i8> %a, i32 0) | ||
| // CHECK-NEXT: ret <16 x i8> [[TMP0]] | ||
| vector unsigned char test_bcdsetsign_imm0(vector unsigned char a) { | ||
| return __builtin_ppc_bcdsetsign(a, '\0'); | ||
| } | ||
|
|
||
| // CHECK-LABEL: test_bcdsetsign_imm1 | ||
| // CHECK: [[TMP0:%.*]] = tail call <16 x i8> @llvm.ppc.bcdsetsign(<16 x i8> %a, i32 1) | ||
| // CHECK-NEXT: ret <16 x i8> [[TMP0]] | ||
| vector unsigned char test_bcdsetsign_imm1(vector unsigned char a) { | ||
| return __builtin_ppc_bcdsetsign(a, '\1'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's strange that the 2nd arg need to be a const of 1 or 0 and we are making the users specify it as a char via
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While it works with 0 and 1, we use '\0' and '\1' as that’s the conventional way to pass an unsigned character, and it ensures the value is treated as a character literal. At runtime, these literals are converted to their corresponding ASCII values. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1630,9 +1630,11 @@ def BCDCTSQ_rec : VX_VT5_EO5_VB5_XO9_o <0, 385, "bcdctsq.", []>; | |
|
|
||
| // Decimal Copy-Sign/Set-Sign | ||
| let Defs = [CR6] in | ||
| def BCDCPSGN_rec : VX1_VT5_VA5_VB5<833, "bcdcpsgn.", []>; | ||
| def BCDCPSGN_rec : VX1_VT5_VA5_VB5<833, "bcdcpsgn.", | ||
| [(set v16i8:$VD, (int_ppc_bcdcopysign v16i8:$VA, v16i8:$VB))]>; | ||
|
|
||
| def BCDSETSGN_rec : VX_VT5_EO5_VB5_PS1_XO9_o<31, 385, "bcdsetsgn.", []>; | ||
| def BCDSETSGN_rec : VX_VT5_EO5_VB5_PS1_XO9_o<31, 385, "bcdsetsgn.", | ||
| [(set v16i8:$VD, (int_ppc_bcdsetsign v16i8:$VB, i32:$PS))]>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping it as i32 since the backend expects and handles it correctly |
||
|
|
||
| // Decimal Shift/Unsigned-Shift/Shift-and-Round | ||
| def BCDS_rec : VX_VT5_VA5_VB5_PS1_XO9_o<193, "bcds." , []>; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown -mcpu=pwr9 \ | ||
| ; RUN: --ppc-asm-full-reg-names < %s | FileCheck %s | ||
| ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-unknown -mcpu=pwr9 \ | ||
| ; RUN: --ppc-asm-full-reg-names < %s | FileCheck %s | ||
| ; RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple=powerpc64-ibm-aix-xcoff \ | ||
| ; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s | ||
|
|
||
| define dso_local <16 x i8> @test_bcdcopysign(<16 x i8> noundef %a, <16 x i8> noundef %b) { | ||
| ; CHECK-LABEL: test_bcdcopysign: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: bcdcpsgn. v2, v2, v3 | ||
| ; CHECK-NEXT: blr | ||
| entry: | ||
| %0 = tail call <16 x i8> @llvm.ppc.bcdcopysign(<16 x i8> %a, <16 x i8> %b) | ||
| ret <16 x i8> %0 | ||
| } | ||
|
|
||
| define dso_local <16 x i8> @test_bcdsetsign_imm0(<16 x i8> noundef %a) { | ||
| ; CHECK-LABEL: test_bcdsetsign_imm0: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: bcdsetsgn. v2, v2, 0 | ||
| ; CHECK-NEXT: blr | ||
| entry: | ||
| %0 = tail call <16 x i8> @llvm.ppc.bcdsetsign(<16 x i8> %a, i32 0) | ||
| ret <16 x i8> %0 | ||
| } | ||
|
|
||
| define dso_local <16 x i8> @test_bcdsetsign_imm1(<16 x i8> noundef %a) { | ||
| ; CHECK-LABEL: test_bcdsetsign_imm1: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: bcdsetsgn. v2, v2, 1 | ||
| ; CHECK-NEXT: blr | ||
| entry: | ||
| %0 = tail call <16 x i8> @llvm.ppc.bcdsetsign(<16 x i8> %a, i32 1) | ||
| ret <16 x i8> %0 | ||
| } | ||
|
|
||
| declare <16 x i8> @llvm.ppc.bcdcopysign(<16 x i8>, <16 x i8>) | ||
| declare <16 x i8> @llvm.ppc.bcdsetsign(<16 x i8>, i32) |
Uh oh!
There was an error while loading. Please reload this page.