[PATCH] D88570: [SDag] SimplifyDemandedBits: simplify to FP constant if all bits known

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 08:35:16 PDT 2020


spatel added inline comments.


================
Comment at: llvm/test/CodeGen/X86/uint_to_fp-2.ll:11
+; CHECK-NEXT:    orpd {{\.LCPI.*}}, %xmm0
+; CHECK-NEXT:    subsd {{\.LCPI.*}}, %xmm0
+; CHECK-NEXT:    cvtsd2ss %xmm0, %xmm0
----------------
RKSimon wrote:
> @craig.topper @spatel This looks like we're loading the same constant as (double x) and <double x, double ???> - do you know if we already have examples of this or is this a new type of regression?
We might avoid that by checking number of uses of the constant?

Looks like a general shortcoming of combining/hoisting constants:

```
$ cat vec_const.ll 
define <4 x i32> @f(<4 x i32> %x) {
  %a1 = add <4 x i32> %x, <i32 1, i32 2, i32 3, i32 4>
  %a2 = xor <4 x i32> %a1, <i32 1, i32 2, i32 3, i32 undef>
  ret <4 x i32> %a2
}
$ llc -o - vec_const.ll 
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 10, 15
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function f
LCPI0_0:
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
	.long	4                               ## 0x4
LCPI0_1:
	.long	1                               ## 0x1
	.long	2                               ## 0x2
	.long	3                               ## 0x3
	.space	4
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_f
	.p2align	4, 0x90
_f:                                     ## @f
	.cfi_startproc
## %bb.0:
	paddd	LCPI0_0(%rip), %xmm0
	pxor	LCPI0_1(%rip), %xmm0
	retq

```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88570/new/

https://reviews.llvm.org/D88570



More information about the llvm-commits mailing list