@@ -34,5 +34,55 @@ define float @still_not_fabs(float %x) #0 {
34
34
ret float %cond
35
35
}
36
36
37
+ define float @nabsf (float %a ) {
38
+ ; CHECK-LABEL: nabsf:
39
+ ; CHECK: // %bb.0:
40
+ ; CHECK-NEXT: fmov w8, s0
41
+ ; CHECK-NEXT: orr w8, w8, #0x80000000
42
+ ; CHECK-NEXT: fmov s0, w8
43
+ ; CHECK-NEXT: ret
44
+ %conv = bitcast float %a to i32
45
+ %and = or i32 %conv , -2147483648
46
+ %conv1 = bitcast i32 %and to float
47
+ ret float %conv1
48
+ }
49
+
50
+ define double @nabsd (double %a ) {
51
+ ; CHECK-LABEL: nabsd:
52
+ ; CHECK: // %bb.0:
53
+ ; CHECK-NEXT: fmov x8, d0
54
+ ; CHECK-NEXT: orr x8, x8, #0x8000000000000000
55
+ ; CHECK-NEXT: fmov d0, x8
56
+ ; CHECK-NEXT: ret
57
+ %conv = bitcast double %a to i64
58
+ %and = or i64 %conv , -9223372036854775808
59
+ %conv1 = bitcast i64 %and to double
60
+ ret double %conv1
61
+ }
62
+
63
+ define <4 x float > @nabsv4f32 (<4 x float > %a ) {
64
+ ; CHECK-LABEL: nabsv4f32:
65
+ ; CHECK: // %bb.0:
66
+ ; CHECK-NEXT: orr v0.4s, #128, lsl #24
67
+ ; CHECK-NEXT: ret
68
+ %conv = bitcast <4 x float > %a to <4 x i32 >
69
+ %and = or <4 x i32 > %conv , <i32 -2147483648 , i32 -2147483648 , i32 -2147483648 , i32 -2147483648 >
70
+ %conv1 = bitcast <4 x i32 > %and to <4 x float >
71
+ ret <4 x float > %conv1
72
+ }
73
+
74
+ define <2 x double > @nabsv2d64 (<2 x double > %a ) {
75
+ ; CHECK-LABEL: nabsv2d64:
76
+ ; CHECK: // %bb.0:
77
+ ; CHECK-NEXT: orr x8, xzr, #0x8000000000000000
78
+ ; CHECK-NEXT: dup v1.2d, x8
79
+ ; CHECK-NEXT: orr v0.16b, v0.16b, v1.16b
80
+ ; CHECK-NEXT: ret
81
+ %conv = bitcast <2 x double > %a to <2 x i64 >
82
+ %and = or <2 x i64 > %conv , <i64 -9223372036854775808 , i64 -9223372036854775808 >
83
+ %conv1 = bitcast <2 x i64 > %and to <2 x double >
84
+ ret <2 x double > %conv1
85
+ }
86
+
37
87
attributes #0 = { "no-nans-fp-math" ="true" }
38
88
0 commit comments