1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -reassociate -S | FileCheck %s
4 ; Don't produce an instruction that is a no-op because the constant is an identity constant.
6 define i32 @add_0(i32 %x) {
8 ; CHECK-NEXT: ret i32 [[X:%.*]]
15 define i32 @mul_1(i32 %x) {
16 ; CHECK-LABEL: @mul_1(
17 ; CHECK-NEXT: ret i32 [[X:%.*]]
24 define i8 @and_neg1(i8 %x) {
25 ; CHECK-LABEL: @and_neg1(
26 ; CHECK-NEXT: ret i8 [[X:%.*]]
33 define i8 @or_0(i8 %x) {
35 ; CHECK-NEXT: ret i8 [[X:%.*]]
42 define i8 @xor_0(i8 %x) {
43 ; CHECK-LABEL: @xor_0(
44 ; CHECK-NEXT: ret i8 [[X:%.*]]
51 ; FIXME - the binop identity constant for fadd is -0.0, so this didn't fold.
53 define float @fadd_0(float %x) {
54 ; CHECK-LABEL: @fadd_0(
55 ; CHECK-NEXT: [[A2:%.*]] = fadd fast float [[X:%.*]], 0.000000e+00
56 ; CHECK-NEXT: ret float [[A2]]
58 %a1 = fadd fast float %x, -30.0
59 %a2 = fadd fast float %a1, 30.0
63 define float @fmul_1(float %x) {
64 ; CHECK-LABEL: @fmul_1(
65 ; CHECK-NEXT: ret float [[X:%.*]]
67 %a1 = fmul fast float %x, 4.0
68 %a2 = fmul fast float %a1, 0.25